Class: Queris::Query::UnionOp
Direct Known Subclasses
Constant Summary collapse
- COMMAND =
:zunionstore- SYMBOL =
:'∪'- NAME =
:union- OPTIMIZATION_THRESHOLD_MULTIPLIER =
3
Instance Attribute Summary
Attributes inherited from Op
Instance Method Summary collapse
Methods inherited from Op
#command, #initialize, #json_redis_dump, #keys, #marshal_dump, #notready!, #operand_key, #operand_key_weight, #optimized?, #prepare, #push, #query_run_stage_inspect, #query_run_stage_release, #run, #subqueries, #symbol, #target_key_weight, #temp_keys, #temp_keys?, #to_s, #weights
Constructor Details
This class inherits a constructor from Queris::Query::Op
Instance Method Details
#optimize(smallkey, smallsize, page = nil) ⇒ Object
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/queris/query/operations.rb', line 304 def optimize(smallkey, smallsize, page=nil) m = self.class::OPTIMIZATION_THRESHOLD_MULTIPLIER super do |key, size, op| if op.is_query? && !op.index.paged? #puts "optimizing unpaged subquery #{op.index} later" op.delayed_optimize_query(smallkey, m) elsif smallsize * m < size #puts "optimization reduced union(?) operand #{op} from #{size} to #{smallsize}" op.preintersect(smallkey, key) elsif page && page.size * m < size #puts "paging reduced union(?) operand #{op} from #{size} to #{page.size}" op.preintersect(page.key, key) end end return smallkey, smallsize end |