Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.12
-
None
-
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
- set optimizer_trace=1
- SELECT // need to run SELECT, not EXPLAIN
- select * from optimizer_trace
And then look for something like this:
"join_execution": {
|
...
|
"filesort_priority_queue_optimization": {
|
"limit": 10,
|
"rows_estimate": 198717,
|
"row_size": 215,
|
"memory_available": 262144,
|
"chosen": true
|
},
|
In MariaDB, there is no optimizer_trace, so one can't see it at all.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | Sergei Petrunia [ psergey ] |
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 * set optimizer_trace=1 * SELECT // need to run SELECT, not EXPLAIN * select * from optimizer_trace And then look for something like this: {nformat} "join_execution": { ... "filesort_priority_queue_optimization": { "limit": 10, "rows_estimate": 198717, "row_size": 215, "memory_available": 262144, "chosen": true }, {noformat} In MariaDB, one can't see it at all. |
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 * set optimizer_trace=1 * SELECT // need to run SELECT, not EXPLAIN * select * from optimizer_trace And then look for something like this: {noformat} "join_execution": { ... "filesort_priority_queue_optimization": { "limit": 10, "rows_estimate": 198717, "row_size": 215, "memory_available": 262144, "chosen": true }, {noformat} In MariaDB, one can't see it at all. |
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 * set optimizer_trace=1 * SELECT // need to run SELECT, not EXPLAIN * select * from optimizer_trace And then look for something like this: {noformat} "join_execution": { ... "filesort_priority_queue_optimization": { "limit": 10, "rows_estimate": 198717, "row_size": 215, "memory_available": 262144, "chosen": true }, {noformat} In MariaDB, one can't see it at all. |
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 * set optimizer_trace=1 * SELECT // need to run SELECT, not EXPLAIN * select * from optimizer_trace And then look for something like this: {noformat} "join_execution": { ... "filesort_priority_queue_optimization": { "limit": 10, "rows_estimate": 198717, "row_size": 215, "memory_available": 262144, "chosen": true }, {noformat} In MariaDB, there is no optimizer_trace, so one can't see it at all. |
Fix Version/s | 10.0.13 [ 16300 ] | |
Fix Version/s | 10.0 [ 16000 ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | MariaDB v2 [ 49715 ] | MariaDB v3 [ 64328 ] |
Workflow | MariaDB v3 [ 64328 ] | MariaDB v4 [ 148021 ] |
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:
#0 check_if_pq_applicable (param=0x7ffff7e9fb50, filesort_info=0x7ffff7e9fbd0, table=0x7fffe3cabe70, num_rows=216437, memory_available=2097152) at /home/psergey/dev2/10.0/sql/filesort.cc:1307
#1 0x000000000084db80 in filesort (thd=0x7fffd4398070, table=0x7fffe3cabe70, sortorder=0x7fffe3c948a8, s_length=1, select=0x7fffe3c943b0, max_rows=10, sort_positions=false, examined_rows=0x7ffff7ea0100, found_rows=0x7ffff7ea0108) at /home/psergey/dev2/10.0/sql/filesort.cc:224
#2 0x00000000006c46aa in create_sort_index (thd=0x7fffd4398070, join=0x7fffe3c78a98, order=0x7fffe3c78988, filesort_limit=10, select_limit=10, is_order_by=true) at /home/psergey/dev2/10.0/sql/sql_select.cc:20571
#3 0x0000000000699c40 in JOIN::exec_inner (this=0x7fffe3c78a98) at /home/psergey/dev2/10.0/sql/sql_select.cc:3046
#4 0x0000000000697142 in JOIN::exec (this=0x7fffe3c78a98) at /home/psergey/dev2/10.0/sql/sql_select.cc:2366
#5 0x000000000069a715 in mysql_select (thd=0x7fffd4398070, rref_pointer_array=0x7fffd439c6d8, tables=0x7fffe3c78290, wild_num=1, fields=..., conds=0x0, og_num=1, order=0x7fffe3c78988, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fffe3c78a78, unit=0x7fffd439bd78, select_lex=0x7fffd439c460) at /home/psergey/dev2/10.0/sql/sql_select.cc:3303
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.