MySQL 8.4.2
Source Code Documentation
|
Go to the source code of this file.
Functions | |
Item * | CommonSubexpressionElimination (Item *cond) |
Do simple CSE (common subexpression elimination) on “item”, and return the answer. More... | |
Do simple CSE (common subexpression elimination) on “item”, and return the answer.
The CSE done is exclusively moving common expressions out of conjunctions-of-disjunctions, ie. it rewrites
(a AND b) OR (a AND c)
into
a AND (b OR c)
The primary motivation is that such split-out items are more versatile; they can be pushed independently, be made into hash join conditions etc. However, an added bonus is that the expressions will simply execute faster.
This function does not descend into subexpressions that are not AND/OR conjunctions, so e.g. an expression like
1 + ((a AND b) OR (a AND c))
will be left as-is.