class NoSE::Cost::Cost
Cost
model for a backend database
Public Class Methods
new(**options)
click to toggle source
# File lib/nose/cost.rb, line 11 def initialize(**options) @options = options end
Public Instance Methods
delete_cost(_step)
click to toggle source
The cost of performing a deletion from an index @return [Integer]
# File lib/nose/cost.rb, line 47 def delete_cost(_step) fail NotImplementedError, 'Must be implemented in a subclass' end
filter_cost(_step)
click to toggle source
The cost of filtering intermediate results @return [Integer]
# File lib/nose/cost.rb, line 17 def filter_cost(_step) # Assume this has no cost and the cost is captured in the fact that we # have to retrieve more data earlier. All this does is skip records. 0 end
index_lookup_cost(_step)
click to toggle source
The cost of performing a lookup via an index @return [Integer]
# File lib/nose/cost.rb, line 41 def index_lookup_cost(_step) fail NotImplementedError, 'Must be implemented in a subclass' end
insert_cost(_step)
click to toggle source
The cost of performing an insert into an index @return [Integer]
# File lib/nose/cost.rb, line 53 def insert_cost(_step) fail NotImplementedError, 'Must be implemented in a subclass' end
limit_cost(_step)
click to toggle source
The cost of limiting a result set @return [Integer]
# File lib/nose/cost.rb, line 25 def limit_cost(_step) # This is basically free since we just discard data 0 end
pruned_cost(_step)
click to toggle source
This is here for debugging purposes because we need a cost @return [Integer]
# File lib/nose/cost.rb, line 59 def pruned_cost(_step) 0 end
sort_cost(_step)
click to toggle source
The cost of sorting a set of results @return [Integer]
# File lib/nose/cost.rb, line 32 def sort_cost(_step) # TODO: Find some estimate of sort cost # This could be partially captured by the fact that sort + limit # effectively removes the limit 1 end