Class: NoSE::Cost::EntityCountCost

Inherits:
Cost show all
Includes:
Subtype
Defined in:
lib/nose/cost/entity_count.rb

Overview

A cost model which estimates the number of entities transferred

Instance Method Summary collapse

Methods included from Subtype

included

Methods inherited from Cost

#filter_cost, #initialize, #limit_cost, #pruned_cost, #sort_cost

Methods included from Supertype

included

Methods included from Listing

included

Constructor Details

This class inherits a constructor from NoSE::Cost::Cost

Instance Method Details

#delete_cost(step) ⇒ Object

Cost estimate as number of entities deleted



17
18
19
# File 'lib/nose/cost/entity_count.rb', line 17

def delete_cost(step)
  step.state.cardinality
end

#index_lookup_cost(step) ⇒ Numeric

Rough cost estimate as the number of entities retrieved at each step

Returns:

  • (Numeric)


11
12
13
14
# File 'lib/nose/cost/entity_count.rb', line 11

def index_lookup_cost(step)
  # Simply count the number of entities at each step
  step.state.cardinality
end

#insert_cost(step) ⇒ Object

Cost estimate as number of entities inserted



22
23
24
# File 'lib/nose/cost/entity_count.rb', line 22

def insert_cost(step)
  step.state.cardinality
end