[MDEV-11161] second time execution of derived tables (SP/PS) do not use indices. Created: 2016-10-27 Updated: 2017-02-20 Resolved: 2016-11-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2 |
| Fix Version/s: | 5.5.54, 10.0.29, 10.1.20 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Oleksandr Byelkin | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
EXPAIN shows the same plan, but ANALYSE STATEMENT shows reality: full table scan on second execution
for first execution: "table": { second execution: , |
| Comments |
| Comment by Oleksandr Byelkin [ 2016-10-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
On second execution temporary table for derived table created and filled way earlier (just after optimize derived first call). Then it has no keys to use: m2 type: ALL q_keys: 0 refs: 0 key: -1 len: 0 vs Info about JOIN and so second time full scan used | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2016-11-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is a mariadb-5.5 bug (actually a mariadb-5.3 bug). This bug could be observed in maridb-5.5:
The different handler counters for the above two executions of the same prepared statement | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2016-11-12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The fix for this bug was pushed into the 5.5 tree. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2016-11-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Will, |