[MDEV-325] SHOW EXPLAIN: Plan produced by SHOW EXPLAIN is different from standard EXPLAIN: type ALL vs 'index_merge', keys is different, 'Using sort_union(a,b);' is missing Created: 2012-06-07 Updated: 2012-11-04 Resolved: 2012-07-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 10.0.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
For the following query
standard EXPLAIN returns
SHOW EXPLAIN sometimes produces the same in the beginning, but then switches to
bzr version-info
Reproducible with MyISAM and Aria, with the default optimizer_switch. Test case:
|
| Comments |
| Comment by Sergei Petrunia [ 2012-06-08 ] |
|
All of these issues and BUG#992942... Seems like detailed study of ORDER BY processing is un-avoidable. |
| Comment by Sergei Petrunia [ 2012-06-22 ] |
|
The problem is caused by these lines in create_sort_index(): if (select) { /* We need to preserve tablesort's output resultset here, because QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT (called by SQL_SELECT::cleanup()) may free it assuming it's the result of the quick select operation that we no longer need. Note that all the other parts of this data structure are cleaned up when QUICK_INDEX_MERGE_SELECT::get_next encounters end of data, so the next SQL_SELECT::cleanup() call changes sort.io_cache alone. */ IO_CACHE *tablesort_result_cache; tablesort_result_cache= table->sort.io_cache; table->sort.io_cache= NULL; select->cleanup(); // filesort did select table->quick_keys.clear_all(); // as far as we cleanup select->quick table->intersect_keys.clear_all(); table->sort.io_cache= tablesort_result_cache; }Here, it destroys the quick select. |
| Comment by Sergei Petrunia [ 2012-07-27 ] |
|
Has been pushed some time ago into 5.5-show-explain-testing1, now considering it closed. |