[MDEV-10449] SELECT DISTINCT ... ORDER BY ... LIMIT not sorting results from partitioned table Created: 2016-07-26 Updated: 2020-08-25 Resolved: 2018-07-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Partitioning, Storage Engine - InnoDB |
| Affects Version/s: | 10.1.14, 5.5, 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Sergei Petrunia |
| Resolution: | Won't Fix | Votes: | 2 |
| Labels: | innodb, partitioning, upstream-fixed | ||
| Issue Links: |
|
||||||||
| Description |
|
Let's create two tables:
And then insert the same data into each:
And then let's compare the results of the following two queries:
As you can see from the above results, the results from the partitioned table are not being sorted. If we remove the DISTINCT keyword, it works:
If we remove the LIMIT, it also works:
Query plan:
|
| Comments |
| Comment by Elena Stepanova [ 2016-07-26 ] | ||||||||||||||||||||||||||||||
|
Reproducible on 5.5, 10.0, 10.1, MySQL 5.5. In 10.2, the problem disappeared after the revision below; apparently, the fix was a side-effect of the intended change. I'll pass it over to psergey to decide whether the fixing part can be backported to 10.1, or a separate fix is needed.
| ||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-07-18 ] | ||||||||||||||||||||||||||||||
|
Backporting the above-mentioned fix is practically impossible - it does a huge re-engineering, and also there were bugfixes made after it. We can't get a big portion of 10.2 into 10.1. Fixing this particular bug in 10.1 might be hard and has a risk of introducing other errors. (there is a reason why patch 2cfc450bf78c2d951729d1a0e8f731c0d987b1d5 was huge and took a long time to develop). Considering that there are two stable releases where this bug is not observed - 10.2 and 10.3, I think we can leave this bug without resolution and recommend to upgrade to 10.2 or 10.3 |