[MDEV-19793] Optimizer to prune partitions with ORDER-BY & LIMIT (Feature request) Created: 2019-06-18 Updated: 2019-06-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Gert van Dijk | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Given the following table listed below, I'm always inserting in the last partition and most SELECTs are ORDER BY my_id DESC LIMIT 100 (in English: "give me latest 100 items of..."). For the inserts partitioning is working very well, but for SELECTs the optimizer seems not smart enough.
I found that MariaDB's optimizer is not clever enough to:
IOW: "If there is a LIMIT and ORDER BY k DESC where k is the entire partition key, then scan the partitions in reverse order and be prepared to stop at LIMIT". (by Rick James) How did I test this?
Specifying partitions manually boosts performance as expected, but that is quite cumbersome, and also it does not work through a SPIDER instance, so I can't really do that in practice. To give an English analogy that describes this feature request best:
More context in my Q on DBA.SE. Related issues I've found:
|