class NoSE::Cost::RequestCountCost

A cost model which estimates the number of requests to the backend

Public Instance Methods

delete_cost(step) click to toggle source

Cost estimate as number of entities deleted

# File lib/nose/cost/request_count.rb, line 22
def delete_cost(step)
  step.state.cardinality
end
index_lookup_cost(step) click to toggle source

Rough cost estimate as the number of requests made @return [Numeric]

# File lib/nose/cost/request_count.rb, line 11
def index_lookup_cost(step)
  # We always start with a single lookup, then the number
  # of lookups is determined by the cardinality at the preceding step
  if step.parent.is_a?(Plans::RootPlanStep)
    1
  else
    step.state.cardinality
  end
end
insert_cost(step) click to toggle source

Cost estimate as number of entities inserted

# File lib/nose/cost/request_count.rb, line 27
def insert_cost(step)
  step.state.cardinality
end