[MDEV-13897] SELECT @a := MAX(col) FROM t requires full index scan Created: 2017-09-23 Updated: 2020-08-25 Resolved: 2017-09-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0, 10.1, 10.1.24, 10.2.9, 10.2 |
| Fix Version/s: | 10.1.28, 10.2.10 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Valerii Kravchuk | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
MariaDB 10.1.x and 10.2.x do not apply " Select tables optimized away" optimization when MAX(col) value is assigned to a user variable. Consider the following primitive test case:
Note that SELECT MAX(col) INTO @a FROM t is NOT affected. With any large table this leads to huge difference in query execution time, as full index scan is slow. Upstream MySQL 5.6.x is also not affected:
|
| Comments |
| Comment by Elena Stepanova [ 2017-09-23 ] |
|
Reproducible on 10.x, not reproducible on MariaDB 5.5 or MySQL 5.x. |
| Comment by Hartmut Holzgraefe [ 2017-09-26 ] |
|
Reproducible starting with 10.0.5, 10.0.4 wasn't affected yet .... |
| Comment by Hartmut Holzgraefe [ 2017-09-27 ] |
|
I tried to manually bisect this, and the change first appeared with https://github.com/MariaDB/server/commit/76e2fe0f661194ae6f6a71c2943646e25de2dd75 ... which is strange as that's just a merge commit, so the actual change should already have happened in one of the actual changesets earlier in the git log history? |