[MDEV-22416] "pushdown" of MIN/MAX inside UNION Created: 2020-04-05 Updated: 2023-12-12 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | 11.5 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Oleksandr Byelkin | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | optimizer | ||
| Issue Links: |
|
||||||||
| Description |
|
There is min/max optimization in case of single SELECT, i.e:
We check only index for max (or min) value. But if we have (probably via VIEW)
we get all tables in temporary table than scan it for max (min). If we transform the above query to :
optimisation will be still possible. The idea of optimization is to push MIN/MAX into each part of the UNION if possible (It might not be possible for some SELECTs in the UNION) Optimization is not possible in case:
Also possible such transformation for COUNT (only for ALL UNION):
to
|
| Comments |
| Comment by Oleksandr Byelkin [ 2020-04-05 ] |
|
As psergey mentioned there could be problems with type casting (need to be checked in transformation) |
| Comment by Julien Fritsch [ 2020-04-06 ] |
|
sanja since the fixversion is missing, I've added N/A to ensure this get listed into the dev or maintenance list, but please adjust it later. |
| Comment by Oleksandr Byelkin [ 2021-03-01 ] |
|
Current plans is to start working on this in April |