[MDEV-32475] test_if_skip_sort_order() should catch the join types JT_EQ_REF, JT_CONST and JT_SYSTEM and skip sort order for these Created: 2023-10-14 Updated: 2023-11-06 Resolved: 2023-10-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Oleg Smirnov | Assignee: | Oleg Smirnov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
In TODO-4276 a customer faced an issue when an efficient "eq_ref" access was replaced with "index" access due to present ORDER BY clause. Such replacements must not happen for JT_EQ_REF, JT_CONST and JT_SYSTEM join types. |
| Comments |
| Comment by Oleg Smirnov [ 2023-10-14 ] | |||||||||||
|
MySQL 5.7 also has such a patch:
| |||||||||||
| Comment by Oleg Smirnov [ 2023-10-18 ] | |||||||||||
|
psergei, please review bb-10.4-mdev-32475. | |||||||||||
| Comment by Sergei Petrunia [ 2023-10-19 ] | |||||||||||
|
Hi Oleg! It is true that
Make first line of the he commit comment shorter:
is too long. Something like this:
The original line can go into the detailed comment. Btw, normally, we don't need need to skip sorting like this. If you do
you will see that the optimizer has figured it's order-by-constant and has removed the ORDER BY. | |||||||||||
| Comment by Oleg Smirnov [ 2023-10-23 ] | |||||||||||
|
Addressed your comments, force-pushed to the same branch | |||||||||||
| Comment by Sergei Petrunia [ 2023-10-25 ] | |||||||||||
|
Ok to push. | |||||||||||
| Comment by Oleg Smirnov [ 2023-10-25 ] | |||||||||||
|
Pushed to 10.4 | |||||||||||
| Comment by Sergei Petrunia [ 2023-10-31 ] | |||||||||||
|
oleg.smirnov, please check what happens in the non-unique case and perhaps file an MDEV... | |||||||||||
| Comment by Sergei Petrunia [ 2023-10-31 ] | |||||||||||
|
Note for the changelog:
| |||||||||||
| Comment by Oleg Smirnov [ 2023-11-06 ] | |||||||||||
|
The same test case, but now table t1 doesn't have a PRIMARY KEY, only a non-unique indexes on fields "a" and "b":
We can see that "ref" access is not substituted in test_if_skip_sort_order(). psergei, I believe it's the correct behaviour? |