[MDEV-17613] MIN/MAX Optimization (Select tables optimized away) does not work Created: 2018-11-05 Updated: 2021-10-26 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Partitioning, Versioned Tables |
| Affects Version/s: | 10.3.7, 10.3 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | hiller1 | Assignee: | Aleksey Midenkov |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
mariadb 10.3 |
||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
MIN/MAX Optimization (Select tables optimized away) does not work
|
| Comments |
| Comment by Alice Sherepa [ 2018-11-05 ] | |||||||||||||||||
|
in 10.3 for table with system versioning:
without system versioning:
| |||||||||||||||||
| Comment by Sergei Golubchik [ 2018-11-05 ] | |||||||||||||||||
|
We can do a special case of a partition pruning optimization here. Because it's partitioned by system_time, and the search is in the current partition, this max() can still be implemented with one key lookup, making it a const table. | |||||||||||||||||
| Comment by Aleksey Midenkov [ 2018-12-25 ] | |||||||||||||||||
FixInstead of adding WHERE ROW_END = MAX condition add current partition selection. | |||||||||||||||||
| Comment by Aleksey Midenkov [ 2019-08-21 ] | |||||||||||||||||
|
Current easy fix is not possible, because SELECT clones ha_partition and then closes the clone which leads to unclosed transactions in partitions we forcely prune out. We could solve this by closing these partitions (and release from transaction) in change_partitions_to_open() at versioning conditions stage, but this is problematic because table lock is acquired for each partition at open stage and therefore must be released when we close partition handler in change_partitions_to_open(). More details in This should change after MDEV-20250 where mechanism of opening partitions will be improved. | |||||||||||||||||
| Comment by Aleksey Midenkov [ 2019-08-21 ] | |||||||||||||||||
|
Upon completion of this task all test cases from the caused issues should be included in test. |