Class: NoSE::Cost::RequestCountCost
- Includes:
- Subtype
- Defined in:
- lib/nose/cost/request_count.rb
Overview
A cost model which estimates the number of requests to the backend
Instance Method Summary collapse
-
#delete_cost(step) ⇒ Object
Cost estimate as number of entities deleted.
-
#index_lookup_cost(step) ⇒ Numeric
Rough cost estimate as the number of requests made.
-
#insert_cost(step) ⇒ Object
Cost estimate as number of entities inserted.
Methods included from Subtype
Methods inherited from Cost
#filter_cost, #initialize, #limit_cost, #pruned_cost, #sort_cost
Methods included from Supertype
Methods included from Listing
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
22 23 24 |
# File 'lib/nose/cost/request_count.rb', line 22 def delete_cost(step) step.state.cardinality end |
#index_lookup_cost(step) ⇒ Numeric
Rough cost estimate as the number of requests made
11 12 13 14 15 16 17 18 19 |
# 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) ⇒ Object
Cost estimate as number of entities inserted
27 28 29 |
# File 'lib/nose/cost/request_count.rb', line 27 def insert_cost(step) step.state.cardinality end |