Method: NoSE::Plans::QueryState#initialize
- Defined in:
- lib/nose/plans/query_planner.rb
#initialize(query, model) ⇒ QueryState
Returns a new instance of QueryState.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nose/plans/query_planner.rb', line 14 def initialize(query, model) @query = query @model = model @fields = query.select @eq = query.eq_fields.dup @range = query.range_field @graph = query.graph @joins = query.materialize_view.graph.join_order(@eq) @order_by = query.order.dup # We never need to order by fields listed in equality predicates # since we'll only ever have rows with a single value @order_by -= @eq.to_a @cardinality = 1 # this will be updated on the first index lookup @hash_cardinality = 1 @given_fields = @eq.dup end |