diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2019-11-09 21:03:23 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2019-11-12 14:40:00 +0300 |
commit | 68ed3a81f2113ecdcd5fce0f0cab636d57ff77da (patch) | |
tree | 6a1ec5f927a864018475f908c005b314b1feaacf | |
parent | 0117d0e65ac8051bc9f6d14764a2ab05e69bd895 (diff) | |
download | mariadb-git-68ed3a81f2113ecdcd5fce0f0cab636d57ff77da.tar.gz |
MDEV-20854: ANALYZE for statements: not clear where the time is spent
Count the "gap" time between table accesses and display it as
r_other_time_ms in the "table" element.
* The advantage of this approach is that it doesn't add any new
my_timer_cycles() calls.
* The disadvantage is that the definition of what is done during
"other time" is not that clear: it includes checking the WHERE
(for this table), constructing index lookup tuple (for the next table)
writing to GROUP BY temporary table (as we dont account for that time
separately [yet], etc)
27 files changed, 448 insertions, 206 deletions
diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc index 08006e26c79..7e18524e44e 100644 --- a/mysql-test/include/analyze-format.inc +++ b/mysql-test/include/analyze-format.inc @@ -1,3 +1,3 @@ # The time on ANALYSE FORMAT=JSON is rather variable ---replace_regex /("(r_total_time_ms|r_buffer_size|r_filling_time_ms)": )[^, \n]*/\1"REPLACED"/ +--replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms)": )[^, \n]*/\1"REPLACED"/ diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index c306c2fc1b3..ccef3a63592 100644 --- a/mysql-test/main/analyze_format_json.result +++ b/mysql-test/main/analyze_format_json.result @@ -15,7 +15,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 30, "attached_condition": "t0.a < 3" @@ -43,7 +44,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 0, "attached_condition": "t0.a > 9 and t0.a is not null" @@ -83,7 +85,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -99,7 +102,8 @@ ANALYZE "r_loops": 10, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 40, "attached_condition": "t1.b < 4" @@ -125,7 +129,8 @@ ANALYZE "r_loops": 1, "rows": 100, "r_rows": 100, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, "attached_condition": "tbl1.b < 20" @@ -137,7 +142,8 @@ ANALYZE "r_loops": 1, "rows": 100, "r_rows": 100, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 60, "attached_condition": "tbl2.b < 60" @@ -163,7 +169,8 @@ ANALYZE "r_loops": 1, "rows": 100, "r_rows": 100, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, "attached_condition": "tbl1.b < 20" @@ -175,7 +182,8 @@ ANALYZE "r_loops": 1, "rows": 100, "r_rows": 100, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 60, "attached_condition": "tbl2.b < 60" @@ -210,7 +218,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a is not null" @@ -226,7 +235,8 @@ ANALYZE "r_loops": 10, "rows": 2, "r_rows": 0.2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "using_index": true @@ -260,7 +270,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, "attached_condition": "test.t1.a < 5" @@ -317,7 +328,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, "index_condition": "t1.pk < 10", @@ -382,7 +394,8 @@ ANALYZE "r_loops": 1, "rows": 5, "r_rows": 5, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -405,7 +418,8 @@ ANALYZE "r_loops": 5, "rows": 1010, "r_rows": 203.8, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 98.135 } @@ -441,7 +455,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, "attached_condition": "tbl1.a < 5" @@ -460,7 +475,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 20, "attached_condition": "tbl2.a in (2,3)" @@ -508,7 +524,8 @@ ANALYZE "r_loops": 1, "rows": 256, "r_rows": 256, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -538,7 +555,8 @@ ANALYZE "r_loops": 1, "rows": 256, "r_rows": 256, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -579,7 +597,8 @@ ANALYZE "r_loops": 1, "rows": 256, "r_rows": 256, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -608,7 +627,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -619,7 +639,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 0, "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))" @@ -642,7 +663,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -694,7 +716,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -705,7 +728,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 0, "attached_condition": "t3.f3 in (1,2)" @@ -779,7 +803,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 0, "attached_condition": "t1.a < 0" diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result index 23f4c39dd5b..e23813944f4 100644 --- a/mysql-test/main/analyze_stmt_orderby.result +++ b/mysql-test/main/analyze_stmt_orderby.result @@ -218,7 +218,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -234,7 +235,8 @@ ANALYZE "r_loops": 10, "rows": 1, "r_rows": 0.4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -304,7 +306,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -322,7 +325,8 @@ ANALYZE "r_loops": 10, "rows": 1, "r_rows": 0.4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -362,7 +366,8 @@ ANALYZE "r_loops": 1, "rows": 1000, "r_rows": 1000, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 50, "attached_condition": "t2.a MOD 2 = 0" @@ -410,7 +415,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -421,7 +427,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -480,7 +487,8 @@ ANALYZE "r_loops": 1, "rows": 5, "r_rows": 5, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 80, "attached_condition": "t6.b > 0 and t6.a <= 5" @@ -492,7 +500,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -586,7 +595,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 20, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "using_index_for_group_by": true diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index de0f515d0ad..d439c2fc39b 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -2407,7 +2407,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -2438,7 +2439,8 @@ ANALYZE "r_loops": 10, "rows": 2, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 90, "attached_condition": "src.counter < 10" diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result index 342340920cf..96efeb03c5e 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -82,7 +82,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -100,7 +101,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -123,7 +125,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -145,7 +148,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -163,7 +167,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -309,7 +314,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -320,7 +326,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -343,7 +350,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -354,7 +362,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -383,7 +392,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -405,7 +415,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -416,7 +427,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -439,7 +451,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -450,7 +463,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/except.test b/mysql-test/main/except.test index 97e4ffcc3f2..090826ce94d 100644 --- a/mysql-test/main/except.test +++ b/mysql-test/main/except.test @@ -13,9 +13,9 @@ EXPLAIN extended (select a,b from t1) except (select c,d from t2); EXPLAIN extended select * from ((select a,b from t1) except (select c,d from t2)) a; EXPLAIN format=json (select a,b from t1) except (select c,d from t2); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json (select a,b from t1) except (select c,d from t2); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json select * from ((select a,b from t1) except (select c,d from t2)) a; select * from ((select a,b from t1) except (select c,d from t2)) a; @@ -45,9 +45,9 @@ EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index ef65107d62c..2903ec857c3 100644 --- a/mysql-test/main/except_all.result +++ b/mysql-test/main/except_all.result @@ -117,7 +117,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -139,7 +140,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -157,7 +159,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -183,7 +186,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -205,7 +209,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -223,7 +228,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -427,7 +433,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -438,7 +445,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -461,7 +469,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -472,7 +481,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -500,7 +510,8 @@ ANALYZE "r_loops": 1, "rows": 9, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -522,7 +533,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -533,7 +545,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -556,7 +569,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -567,7 +581,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index b918e7614af..a48cfcf213b 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -977,7 +977,8 @@ ANALYZE "r_loops": 1, "rows": 101, "r_rows": 100, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "using_index_for_group_by": true @@ -1292,7 +1293,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -1346,7 +1348,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -1361,7 +1364,8 @@ ANALYZE "r_loops": 2, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))", @@ -1421,7 +1425,8 @@ ANALYZE "r_loops": 1, "rows": 2, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a is not null" @@ -1437,7 +1442,8 @@ ANALYZE "r_loops": 2, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "using_index": true, @@ -1512,7 +1518,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "t3.a is not null" @@ -1529,7 +1536,8 @@ ANALYZE "r_loops": 1, "rows": 1, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "index_condition_bka": "t4.b + 1 <= t3.b + 1" diff --git a/mysql-test/main/explain_json_format_partitions.result b/mysql-test/main/explain_json_format_partitions.result index 5d7fdbc4864..0c7d9e93105 100644 --- a/mysql-test/main/explain_json_format_partitions.result +++ b/mysql-test/main/explain_json_format_partitions.result @@ -36,7 +36,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 30, "attached_condition": "t1.a in (2,3,4)" diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result index 7b43e478e30..95a3c2f7db9 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -108,7 +108,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -126,7 +127,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -144,7 +146,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -167,7 +170,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -189,7 +193,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -207,7 +212,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -225,7 +231,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -349,7 +356,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -367,7 +375,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -378,7 +387,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -406,7 +416,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -428,7 +439,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -446,7 +458,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -457,7 +470,8 @@ ANALYZE "r_loops": 1, "rows": 3, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/intersect.test b/mysql-test/main/intersect.test index e42c0d007b5..5e811f1f56d 100644 --- a/mysql-test/main/intersect.test +++ b/mysql-test/main/intersect.test @@ -24,9 +24,9 @@ EXPLAIN (select a,b from t1) intersect (select c,d from t2) intersect (select e, EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); EXPLAIN extended select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; @@ -44,9 +44,9 @@ EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3); EXPLAIN extended select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; set @@optimizer_switch='optimize_join_buffer_size=off'; EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3); ---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/ +--source include/analyze-format.inc ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; set @@optimizer_switch=@save_optimizer_switch; select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 84a97982d13..7483e1df06e 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -120,7 +120,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -138,7 +139,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -156,7 +158,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -179,7 +182,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 2, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -201,7 +205,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -219,7 +224,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -237,7 +243,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -380,7 +387,8 @@ ANALYZE "r_loops": 1, "rows": 6, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -398,7 +406,8 @@ ANALYZE "r_loops": 1, "rows": 5, "r_rows": 5, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -409,7 +418,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -437,7 +447,8 @@ ANALYZE "r_loops": 1, "rows": 6, "r_rows": 3, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { @@ -459,7 +470,8 @@ ANALYZE "r_loops": 1, "rows": 6, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 } @@ -477,7 +489,8 @@ ANALYZE "r_loops": 1, "rows": 5, "r_rows": 5, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -488,7 +501,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index eb790c20493..a803f832935 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -124,7 +124,8 @@ ANALYZE "r_loops": 1, "rows": 509, "r_rows": 60, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 11.69, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -246,7 +247,8 @@ ANALYZE "r_loops": 1, "rows": 509, "r_rows": 510, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 11.69, "r_filtered": 11.765, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -403,7 +405,8 @@ ANALYZE "r_loops": 1, "rows": 98, "r_rows": 98, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -431,7 +434,8 @@ ANALYZE "r_loops": 98, "rows": 1, "r_rows": 0.1122, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 4.6, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -531,7 +535,8 @@ ANALYZE "r_loops": 1, "rows": 98, "r_rows": 98, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -547,7 +552,8 @@ ANALYZE "r_loops": 98, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 4.6, "r_filtered": 11.224, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -682,7 +688,8 @@ ANALYZE "r_loops": 1, "rows": 509, "r_rows": 60, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 11.69, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -711,7 +718,8 @@ ANALYZE "r_loops": 60, "rows": 1, "r_rows": 0.2667, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 9.2667, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -824,7 +832,8 @@ ANALYZE "r_loops": 1, "rows": 509, "r_rows": 510, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 11.69, "r_filtered": 11.765, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -841,7 +850,8 @@ ANALYZE "r_loops": 60, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 9.2667, "r_filtered": 26.667, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -950,7 +960,8 @@ ANALYZE "r_loops": 1, "rows": 69, "r_rows": 71, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -983,7 +994,8 @@ ANALYZE "r_loops": 71, "rows": 4, "r_rows": 0.5211, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 8.4763, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1104,7 +1116,8 @@ ANALYZE "r_loops": 1, "rows": 69, "r_rows": 71, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -1125,7 +1138,8 @@ ANALYZE "r_loops": 71, "rows": 4, "r_rows": 6.7042, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 8.4763, "r_filtered": 7.7731, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1269,7 +1283,8 @@ ANALYZE "r_loops": 1, "rows": 18, "r_rows": 18, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.5662, "r_filtered": 38.889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1286,7 +1301,8 @@ ANALYZE "r_loops": 7, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 7.4667, "r_filtered": 14.286, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1389,7 +1405,8 @@ ANALYZE "r_loops": 1, "rows": 18, "r_rows": 18, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.5662, "r_filtered": 38.889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1406,7 +1423,8 @@ ANALYZE "r_loops": 7, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 7.4667, "r_filtered": 14.286, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1509,7 +1527,8 @@ ANALYZE "r_loops": 1, "rows": 39, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.2, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1531,7 +1550,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1630,7 +1650,8 @@ ANALYZE "r_loops": 1, "rows": 39, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.2, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1652,7 +1673,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1764,7 +1786,8 @@ ANALYZE "r_loops": 1, "rows": 39, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 1.9499, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1786,7 +1809,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1895,7 +1919,8 @@ ANALYZE "r_loops": 1, "rows": 39, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 1.9499, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1917,7 +1942,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 390c7834a0a..c2b3b194c37 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -125,7 +125,8 @@ ANALYZE "r_loops": 1, "rows": 510, "r_rows": 60, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 10.075, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -247,7 +248,8 @@ ANALYZE "r_loops": 1, "rows": 510, "r_rows": 510, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 10.075, "r_filtered": 11.765, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -397,7 +399,8 @@ ANALYZE "r_loops": 1, "rows": 98, "r_rows": 98, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'", @@ -414,7 +417,8 @@ ANALYZE "r_loops": 98, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 4.7333, "r_filtered": 11.224, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -515,7 +519,8 @@ ANALYZE "r_loops": 1, "rows": 98, "r_rows": 98, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'", @@ -532,7 +537,8 @@ ANALYZE "r_loops": 98, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 4.7333, "r_filtered": 11.224, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -633,7 +639,8 @@ ANALYZE "r_loops": 1, "rows": 144, "r_rows": 144, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 180000 and 230000", @@ -656,7 +663,8 @@ ANALYZE "r_loops": 144, "rows": 4, "r_rows": 6.625, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.8557, "r_filtered": 1.6771, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45" @@ -763,7 +771,8 @@ ANALYZE "r_loops": 1, "rows": 144, "r_rows": 144, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 180000 and 230000", @@ -786,7 +795,8 @@ ANALYZE "r_loops": 144, "rows": 4, "r_rows": 6.625, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.8557, "r_filtered": 1.6771, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45" @@ -888,7 +898,8 @@ ANALYZE "r_loops": 1, "rows": 71, "r_rows": 71, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000", @@ -910,7 +921,8 @@ ANALYZE "r_loops": 71, "rows": 4, "r_rows": 6.7042, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 8.4929, "r_filtered": 7.7731, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1032,7 +1044,8 @@ ANALYZE "r_loops": 1, "rows": 71, "r_rows": 71, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000", @@ -1054,7 +1067,8 @@ ANALYZE "r_loops": 71, "rows": 4, "r_rows": 6.7042, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 8.4929, "r_filtered": 7.7731, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1198,7 +1212,8 @@ ANALYZE "r_loops": 1, "rows": 18, "r_rows": 18, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.5662, "r_filtered": 38.889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1215,7 +1230,8 @@ ANALYZE "r_loops": 7, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 5.6667, "r_filtered": 14.286, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1318,7 +1334,8 @@ ANALYZE "r_loops": 1, "rows": 18, "r_rows": 18, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 0.5662, "r_filtered": 38.889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1335,7 +1352,8 @@ ANALYZE "r_loops": 7, "rows": 1, "r_rows": 1, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 5.6667, "r_filtered": 14.286, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1438,7 +1456,8 @@ ANALYZE "r_loops": 1, "rows": 41, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.3333, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1460,7 +1479,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1559,7 +1579,8 @@ ANALYZE "r_loops": 1, "rows": 41, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.3333, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1581,7 +1602,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1693,7 +1715,8 @@ ANALYZE "r_loops": 1, "rows": 41, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 2.0711, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1715,7 +1738,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1824,7 +1848,8 @@ ANALYZE "r_loops": 1, "rows": 41, "r_rows": 41, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 2.0711, "r_filtered": 2.439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1846,7 +1871,8 @@ ANALYZE "r_loops": 1, "rows": 4, "r_rows": 6, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 3.0475, "r_filtered": 66.667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index 0d6f459ce88..e12facf8b8c 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -54,7 +54,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -73,7 +74,8 @@ ANALYZE "r_loops": 4, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" @@ -98,7 +100,8 @@ ANALYZE "r_loops": 1, "rows": 10, "r_rows": 10, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -125,7 +128,8 @@ ANALYZE "r_loops": 4, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" @@ -160,7 +164,8 @@ ANALYZE "r_loops": 4, "rows": 4, "r_rows": 4, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" diff --git a/mysql-test/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result index 473972c2cd4..7d42a9bbd87 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.result +++ b/mysql-test/suite/federated/federatedx_create_handlers.result @@ -228,7 +228,8 @@ ANALYZE "r_loops": 1, "rows": 7, "r_rows": 7, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100 }, @@ -243,7 +244,8 @@ ANALYZE "r_loops": 7, "rows": 2, "r_rows": 0, - "r_total_time_ms": "REPLACED", + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", "filtered": 100, "r_filtered": 100, "materialized": { diff --git a/sql/filesort.cc b/sql/filesort.cc index 3f4291cfb1f..bd6ac9d7374 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -196,7 +196,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, else thd->inc_status_sort_scan(); thd->query_plan_flags|= QPLAN_FILESORT; - tracker->report_use(max_rows); + tracker->report_use(thd, max_rows); // If number of rows is not known, use as much of sort buffer as possible. num_rows= table->file->estimate_rows_upper_bound(); @@ -364,7 +364,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, outfile->end_of_file=save_pos; } } - tracker->report_merge_passes_at_end(thd->query_plan_fsort_passes); + tracker->report_merge_passes_at_end(thd, thd->query_plan_fsort_passes); if (unlikely(error)) { int kill_errno= thd->killed_errno(); diff --git a/sql/handler.h b/sql/handler.h index c751817f5f1..f23476242a0 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -5008,12 +5008,12 @@ int binlog_log_row(TABLE* table, { \ Exec_time_tracker *this_tracker; \ if (unlikely((this_tracker= tracker))) \ - tracker->start_tracking(); \ + tracker->start_tracking(table->in_use); \ \ MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD); \ \ if (unlikely(this_tracker)) \ - tracker->stop_tracking(); \ + tracker->stop_tracking(table->in_use); \ } void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag); diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc index f1c6e2c73ea..fdabcf1e494 100644 --- a/sql/sql_analyze_stmt.cc +++ b/sql/sql_analyze_stmt.cc @@ -80,3 +80,20 @@ void Filesort_tracker::print_json_members(Json_writer *writer) } } +void attach_gap_time_tracker(THD *thd, Gap_time_tracker *gap_tracker, + ulonglong timeval) +{ + thd->gap_tracker_data.bill_to= gap_tracker; + thd->gap_tracker_data.start_time= timeval; +} + +void process_gap_time_tracker(THD *thd, ulonglong timeval) +{ + if (thd->gap_tracker_data.bill_to) + { + thd->gap_tracker_data.bill_to->log_time(thd->gap_tracker_data.start_time, + timeval); + thd->gap_tracker_data.bill_to= NULL; + } +} + diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h index eec52822ae5..9d5151c3be2 100644 --- a/sql/sql_analyze_stmt.h +++ b/sql/sql_analyze_stmt.h @@ -38,6 +38,10 @@ $stmt"). */ +class Gap_time_tracker; +void attach_gap_time_tracker(THD *thd, Gap_time_tracker *gap_tracker, ulonglong timeval); +void process_gap_time_tracker(THD *thd, ulonglong timeval); + /* A class for tracking time it takes to do a certain action */ @@ -48,26 +52,37 @@ protected: ulonglong cycles; ulonglong last_start; - void cycles_stop_tracking() + void cycles_stop_tracking(THD *thd) { ulonglong end= my_timer_cycles(); cycles += end - last_start; if (unlikely(end < last_start)) cycles += ULONGLONG_MAX; + + process_gap_time_tracker(thd, end); + if (my_gap_tracker) + attach_gap_time_tracker(thd, my_gap_tracker, end); } public: - Exec_time_tracker() : count(0), cycles(0) {} - + Exec_time_tracker() : count(0), cycles(0), my_gap_tracker(NULL) {} + + /* + The time spent between stop_tracking() call on this object and any + other time measurement will be billed to this tracker. + */ + Gap_time_tracker *my_gap_tracker; + // interface for collecting time - void start_tracking() + void start_tracking(THD *thd) { last_start= my_timer_cycles(); + process_gap_time_tracker(thd, last_start); } - void stop_tracking() + void stop_tracking(THD *thd) { count++; - cycles_stop_tracking(); + cycles_stop_tracking(thd); } // interface for getting the time @@ -81,6 +96,31 @@ public: /* + Tracker for time spent between the calls to Exec_time_tracker's {start| + stop}_tracking(). + + @seealso Gap_time_tracker_data in sql_class.h +*/ +class Gap_time_tracker +{ + ulonglong cycles; +public: + Gap_time_tracker() : cycles(0) {} + + void log_time(ulonglong start, ulonglong end) { + cycles += end - start; + } + + double get_time_ms() const + { + // convert 'cycles' to milliseconds. + return 1000 * ((double)cycles) / sys_timer_info.cycles.frequency; + } +}; + + + +/* A class for counting certain actions (in all queries), and optionally collecting the timings (in ANALYZE queries). */ @@ -99,22 +139,22 @@ public: /* Unlike Exec_time_tracker::stop_tracking, we don't increase loops. */ - void stop_tracking() + void stop_tracking(THD *thd) { - cycles_stop_tracking(); + cycles_stop_tracking(thd); } }; -#define ANALYZE_START_TRACKING(tracker) \ +#define ANALYZE_START_TRACKING(thd, tracker) \ { \ (tracker)->incr_loops(); \ if (unlikely((tracker)->timed)) \ - { (tracker)->start_tracking(); } \ + { (tracker)->start_tracking(thd); } \ } -#define ANALYZE_STOP_TRACKING(tracker) \ +#define ANALYZE_STOP_TRACKING(thd, tracker) \ if (unlikely((tracker)->timed)) \ - { (tracker)->stop_tracking(); } + { (tracker)->stop_tracking(thd); } /* A class for collecting read statistics. @@ -186,14 +226,14 @@ public: /* Functions that filesort uses to report various things about its execution */ - inline void report_use(ha_rows r_limit_arg) + inline void report_use(THD *thd, ha_rows r_limit_arg) { if (!time_tracker.get_loops()) r_limit= r_limit_arg; else r_limit= (r_limit != r_limit_arg)? 0: r_limit_arg; - ANALYZE_START_TRACKING(&time_tracker); + ANALYZE_START_TRACKING(thd, &time_tracker); } inline void incr_pq_used() { r_used_pq++; } @@ -210,9 +250,9 @@ public: { sort_passes -= passes; } - inline void report_merge_passes_at_end(ulong passes) + inline void report_merge_passes_at_end(THD *thd, ulong passes) { - ANALYZE_STOP_TRACKING(&time_tracker); + ANALYZE_STOP_TRACKING(thd, &time_tracker); sort_passes += passes; } @@ -318,14 +358,14 @@ public: container_elements(0), n_checks(0), n_positive_checks(0) {} - inline void start_tracking() + inline void start_tracking(THD *thd) { - ANALYZE_START_TRACKING(&time_tracker); + ANALYZE_START_TRACKING(thd, &time_tracker); } - inline void stop_tracking() + inline void stop_tracking(THD *thd) { - ANALYZE_STOP_TRACKING(&time_tracker); + ANALYZE_STOP_TRACKING(thd, &time_tracker); } /* Save container buffer size in bytes */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cc572065e92..0aca810692e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1336,6 +1336,7 @@ void THD::init() #endif //EMBEDDED_LIBRARY apc_target.init(&LOCK_thd_kill); + gap_tracker_data.init(); DBUG_VOID_RETURN; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 2fb5797b325..0618bbdccbf 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2141,6 +2141,22 @@ struct wait_for_commit extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); +class Gap_time_tracker; + +/* + Thread context for Gap_time_tracker class. +*/ +class Gap_time_tracker_data +{ +public: + Gap_time_tracker_data(): bill_to(NULL) {} + + Gap_time_tracker *bill_to; + ulonglong start_time; + + void init() { bill_to = NULL; } +}; + /** A wrapper around thread_count. @@ -3326,6 +3342,7 @@ public: */ Apc_target apc_target; + Gap_time_tracker_data gap_tracker_data; #ifndef MYSQL_CLIENT enum enum_binlog_query_type { /* The query can be logged in row format or in statement format. */ diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 0ea00a7d61c..b12312041bd 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -600,7 +600,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (!(explain= query_plan.save_explain_delete_data(thd->mem_root, thd))) goto got_error; - ANALYZE_START_TRACKING(&explain->command_tracker); + ANALYZE_START_TRACKING(thd, &explain->command_tracker); DBUG_EXECUTE_IF("show_explain_probe_delete_exec_start", dbug_serve_apcs(thd, 1);); @@ -878,7 +878,7 @@ terminate_delete: table->file->ha_release_auto_increment(); if (options & OPTION_QUICK) (void) table->file->extra(HA_EXTRA_NORMAL); - ANALYZE_STOP_TRACKING(&explain->command_tracker); + ANALYZE_STOP_TRACKING(thd, &explain->command_tracker); cleanup: /* diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index d3b85638898..da727ba54fc 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -1811,10 +1811,11 @@ void Explain_table_access::print_explain_json(Explain_query *query, double total_time= op_tracker.get_time_ms(); if (rowid_filter) total_time+= rowid_filter->tracker->get_time_fill_container_ms(); - writer->add_member("r_total_time_ms").add_double(total_time); + writer->add_member("r_table_time_ms").add_double(total_time); + writer->add_member("r_other_time_ms").add_double(extra_time_tracker.get_time_ms()); } } - + /* `filtered` */ if (filtered_set) writer->add_member("filtered").add_double(filtered); diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 3896636f9fd..bd8c8a4d499 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -835,6 +835,8 @@ public: /* Tracker for reading the table */ Table_access_tracker tracker; Exec_time_tracker op_tracker; + Gap_time_tracker extra_time_tracker; + Table_access_tracker jbuf_tracker; Explain_rowid_filter *rowid_filter; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 268fec84e3b..38f5b7a5a44 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4168,9 +4168,9 @@ void JOIN::exec() select_lex->select_number)) dbug_serve_apcs(thd, 1); ); - ANALYZE_START_TRACKING(&explain->time_tracker); + ANALYZE_START_TRACKING(thd, &explain->time_tracker); exec_inner(); - ANALYZE_STOP_TRACKING(&explain->time_tracker); + ANALYZE_STOP_TRACKING(thd, &explain->time_tracker); DBUG_EXECUTE_IF("show_explain_probe_join_exec_end", if (dbug_user_var_equals_int(thd, @@ -13139,7 +13139,7 @@ void JOIN_TAB::build_range_rowid_filter_if_needed() Exec_time_tracker *table_tracker= table->file->get_time_tracker(); Rowid_filter_tracker *rowid_tracker= rowid_filter->get_tracker(); table->file->set_time_tracker(rowid_tracker->get_time_tracker()); - rowid_tracker->start_tracking(); + rowid_tracker->start_tracking(join->thd); if (!rowid_filter->build()) { is_rowid_filter_built= true; @@ -13149,7 +13149,7 @@ void JOIN_TAB::build_range_rowid_filter_if_needed() delete rowid_filter; rowid_filter= 0; } - rowid_tracker->stop_tracking(); + rowid_tracker->stop_tracking(join->thd); table->file->set_time_tracker(table_tracker); } } @@ -26076,8 +26076,10 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta, /* Enable the table access time tracker only for "ANALYZE stmt" */ if (thd->lex->analyze_stmt) + { table->file->set_time_tracker(&eta->op_tracker); - + eta->op_tracker.my_gap_tracker = &eta->extra_time_tracker; + } /* No need to save id and select_type here, they are kept in Explain_select */ /* table */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 9f298a51b72..26dfe5e40a2 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -666,7 +666,7 @@ int mysql_update(THD *thd, if (!(explain= query_plan.save_explain_update_data(query_plan.mem_root, thd))) goto err; - ANALYZE_START_TRACKING(&explain->command_tracker); + ANALYZE_START_TRACKING(thd, &explain->command_tracker); DBUG_EXECUTE_IF("show_explain_probe_update_exec_start", dbug_serve_apcs(thd, 1);); @@ -1168,7 +1168,7 @@ update_begin: break; } } - ANALYZE_STOP_TRACKING(&explain->command_tracker); + ANALYZE_STOP_TRACKING(thd, &explain->command_tracker); table->auto_increment_field_not_null= FALSE; dup_key_found= 0; /* |