class NoSE::Cost::FieldSizeCost

A cost model which estimates the total size of data transferred

Public Instance Methods

delete_cost(step) click to toggle source

Cost estimate as the size of an index entry

# File lib/nose/cost/field_size.rb, line 21
def delete_cost(step)
  step.index.entry_size
end
index_lookup_cost(step) click to toggle source

Rough cost estimate as the size of data returned @return [Numeric]

# File lib/nose/cost/field_size.rb, line 11
def index_lookup_cost(step)
  # If we have an answer to the query, we only need
  # to fetch the data fields which are selected
  fields = step.index.all_fields
  fields &= step.state.query.select if step.state.answered?

  step.state.cardinality * fields.sum_by(&:size)
end
insert_cost(step) click to toggle source

Cost estimate as the size of an index entry

# File lib/nose/cost/field_size.rb, line 26
def insert_cost(step)
  step.index.entry_size
end