[MDEV-6430] It is impossible to see if "filesort with small limit" optimization was used Created: 2014-07-08 Updated: 2014-07-09 Resolved: 2014-07-09 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.12 |
| Fix Version/s: | 10.0.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We've ported "filesort with small limit" optimization from mysql-5.6 into MariaDB 10.0. The problem is, it is impossible to see whether that optimization is used or not. In MySQL, one can check this as follows
And then look for something like this:
In MariaDB, there is no optimizer_trace, so one can't see it at all. |
| Comments |
| Comment by Sergei Petrunia [ 2014-07-08 ] | |||||||||||||
|
It would be logical if the output was reflected in EXPLAIN. The problem is that both MySQL and MariaDB make the decision about whether to use PQ at a very late phase:
EXPLAIN execution does not go through filesort()/check_if_pq_applicable(). In order to check whether we're using PQ in EXPLAIN, one would need to do some code re-structuring. | |||||||||||||
| Comment by Sergei Petrunia [ 2014-07-08 ] | |||||||||||||
|
Status variables do not have a counter for PQ-based sorting:
| |||||||||||||
| Comment by Sergei Petrunia [ 2014-07-08 ] | |||||||||||||
|
Slow query log entry (with log_slow_verbosity=query_plan,explain):
" Filesort: Yes " comes from "log_slow_verbosity=explain", which originally comes from "extended statistics in the slow query log" from Percona Server. It may be natural to extend it to show whether PQ-based sorting was used. | |||||||||||||
| Comment by Sergei Petrunia [ 2014-07-09 ] | |||||||||||||
|
Decisions after discussion: will both add a status counter and a slow query log entry. Slow query log entries will look like this:
pt-query-digest is able to parse this. Status variable name will be:
|