Query Optimizer (Raptor) #477
Replies: 5 comments 3 replies
-
OptimizationsSee An Overview of the Starburst Trino Query Optimizer predicate pushdown limit pushdowns add predicates SELECT * FROM A INNER JOIN B ON A.x = B.y WHERE A.x = 10 We know a condition on join reorders Include row estimates and filter estimations (min/max and centiles - e.g. we know at most 50% of records are greater than n), including - if possible - an estimate of the matches from a previous join: |
Beta Was this translation helpful? Give feedback.
-
query.optimizer .plan_contains(operation) -> name (Select before join) We already do projection pushdown |
Beta Was this translation helpful? Give feedback.
-
The first optimization will simply be to split commutative predicates in the WHERE and HAVING clauses into individual expressions. This should have a minor performance benefit without any further changes. This lends itself to two subsequent optimisations
|
Beta Was this translation helpful? Give feedback.
-
https://dev.mysql.com/doc/internals/en/optimizer-primary-optimizations.html Contains a set of rule-based optimizations. |
Beta Was this translation helpful? Give feedback.
-
https://dev.mysql.com/doc/internals/en/optimizer-primary-optimizations.html Contains a set of rule-based optimizations. |
Beta Was this translation helpful? Give feedback.
-
Query optimization is likely to exist as a rule engine which takes a plan and (if available) table statistics, and performs optimisations.
This should be implemented as a battery with multiple passes (and some sort of flap detection) where the inputs are run through each optimization rule, until no changes have been made (the event of multiple rules doing and undoing optimisations should be captured).
Verbose logging should be used to capture the AST, the original plan and the final plan.
Some randomisation should be included to allow for comparison of plans, for example randomly not applying a specific optimization, the order being random and/or the number of cycles being random). This should result in some minor variations in the plans which can then be compared to identify optimal order or coexistence of optimisations.
The Optimizer will be given the name Optimizer in the code, but referred to as Raptor
Beta Was this translation helpful? Give feedback.
All reactions