diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result index f3694b4278a..9022d8c2751 100644 --- a/mysql-test/r/analyze_format_json.result +++ b/mysql-test/r/analyze_format_json.result @@ -3,7 +3,7 @@ create table t0 (a int); INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); # r_filtered=30%, because 3 rows match: 0,1,2 analyze format=json select * from t0 where a<3; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -31,7 +31,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f 1 SIMPLE t1 ref a a 5 test.t0.a 1 NULL 100.00 NULL analyze format=json select * from t0, t1 where t1.a=t0.a and t0.a > 9; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -71,7 +71,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f 1 SIMPLE t1 ref a a 5 test.t0.a 1 1.00 100.00 40.00 Using where analyze format=json select * from t0, t1 where t1.a=t0.a and t1.b<4; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -113,7 +113,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f 1 SIMPLE tbl2 ALL NULL NULL NULL NULL 100 100.00 100.00 94.00 Using where; Using join buffer (flat, BNL join) analyze format=json select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -150,7 +150,7 @@ EXPLAIN } analyze format=json select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -196,7 +196,7 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, key(a)); insert into t2 values (0),(1); analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, @@ -244,7 +244,7 @@ select database(); database() NULL analyze format=json select * from test.t1 where t1.a<5; -EXPLAIN +ANALYZE { "query_block": { "select_id": 1, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ff27bfbac74..1eec73be738 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2464,7 +2464,7 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is { List field_list; if (lex->explain_json) - make_explain_json_field_list(field_list); + make_explain_json_field_list(field_list, is_analyze); else make_explain_field_list(field_list, explain_flags, is_analyze); @@ -2475,9 +2475,12 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is } -void THD::make_explain_json_field_list(List &field_list) +void THD::make_explain_json_field_list(List &field_list, bool is_analyze) { - Item *item= new Item_empty_string("EXPLAIN", 78, system_charset_info); + Item *item= new Item_empty_string((is_analyze ? + "ANALYZE" : + "EXPLAIN"), + 78, system_charset_info); field_list.push_back(item); } diff --git a/sql/sql_class.h b/sql/sql_class.h index fcc7e80aafa..f3106edcb23 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3171,7 +3171,7 @@ public: bool is_analyze); void make_explain_field_list(List &field_list, uint8 explain_flags, bool is_analyze); - void make_explain_json_field_list(List &field_list); + void make_explain_json_field_list(List &field_list, bool is_analyze); /** Clear the current error, if any.