[MDEV-30244] ROW_NUMBER () OVER () with empty OVER () clause seems to perform a sort Created: 2022-12-16 Updated: 2022-12-16 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | 10.10.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Lukas Eder | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Try this query:
It seems to perform a sort, resulting in:
On the other hand, when adding a dummy ORDER BY clause, then the lexical order is preserved:
Resulting in:
I would expect both executions to not touch the ordering of the derived table contents, from a performance perspective. I'm aware that both results are technically correct. I just wanted to make sure there's no performance penalty. |
| Comments |
| Comment by Lukas Eder [ 2022-12-16 ] |
|
I've made a benchmark here: https://github.com/jOOQ/jOOQ/issues/14413#issuecomment-1354623806 |