| 1 |
set @orig_explain_format=@@global.explain_format; |
| 2 |
select @@explain_format, @@global.explain_format; |
| 3 |
@@explain_format @@global.explain_format |
| 4 |
TRADITIONAL_STRICT TRADITIONAL_STRICT |
| 5 |
explain select 1; |
| 6 |
set explain_format=traditional; |
| 7 |
# With hypergraph and TRADITIONAL, EXPLAIN should use TREE format. |
| 8 |
explain select 1; |
| 9 |
EXPLAIN |
| 10 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 11 |
|
| 12 |
# Test that explain_format can be set to any of the scopes; i.e. session, |
| 13 |
# global and persist. |
| 14 |
set persist explain_format=tree; |
| 15 |
select @@explain_format, @@global.explain_format; |
| 16 |
@@explain_format @@global.explain_format |
| 17 |
TRADITIONAL TREE |
| 18 |
set global explain_format=json; |
| 19 |
select @@explain_format, @@global.explain_format; |
| 20 |
@@explain_format @@global.explain_format |
| 21 |
TRADITIONAL JSON |
| 22 |
set explain_format=tree; |
| 23 |
select @@explain_format, @@global.explain_format; |
| 24 |
@@explain_format @@global.explain_format |
| 25 |
TREE JSON |
| 26 |
set explain_format=default; |
| 27 |
select @@explain_format, @@global.explain_format; |
| 28 |
@@explain_format @@global.explain_format |
| 29 |
JSON JSON |
| 30 |
set global explain_format=default; |
| 31 |
select @@explain_format, @@global.explain_format; |
| 32 |
@@explain_format @@global.explain_format |
| 33 |
JSON TRADITIONAL |
| 34 |
set persist explain_format=default; |
| 35 |
select @@explain_format, @@global.explain_format; |
| 36 |
@@explain_format @@global.explain_format |
| 37 |
JSON TRADITIONAL |
| 38 |
set explain_format=default; |
| 39 |
select @@explain_format, @@global.explain_format; |
| 40 |
@@explain_format @@global.explain_format |
| 41 |
TRADITIONAL TRADITIONAL |
| 42 |
reset persist explain_format; |
| 43 |
select @@explain_format, @@global.explain_format; |
| 44 |
@@explain_format @@global.explain_format |
| 45 |
TRADITIONAL TRADITIONAL |
| 46 |
explain select 1; |
| 47 |
EXPLAIN |
| 48 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 49 |
|
| 50 |
explain format=tree select 1; |
| 51 |
EXPLAIN |
| 52 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 53 |
|
| 54 |
explain format=json select 1; |
| 55 |
EXPLAIN |
| 56 |
{ |
| 57 |
"query": "/* select#1 */ select 1 AS `1`", |
| 58 |
"operation": "Rows fetched before execution", |
| 59 |
"access_type": "rows_fetched_before_execution", |
| 60 |
"estimated_rows": 1.0, |
| 61 |
"estimated_total_cost": 0.0, |
| 62 |
"estimated_first_row_cost": 0.0 |
| 63 |
} |
| 64 |
set explain_format=tree; |
| 65 |
explain select 1; |
| 66 |
EXPLAIN |
| 67 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 68 |
|
| 69 |
explain format=json select 1; |
| 70 |
EXPLAIN |
| 71 |
{ |
| 72 |
"query": "/* select#1 */ select 1 AS `1`", |
| 73 |
"operation": "Rows fetched before execution", |
| 74 |
"access_type": "rows_fetched_before_execution", |
| 75 |
"estimated_rows": 1.0, |
| 76 |
"estimated_total_cost": 0.0, |
| 77 |
"estimated_first_row_cost": 0.0 |
| 78 |
} |
| 79 |
set explain_format=json; |
| 80 |
explain format=tree select 1; |
| 81 |
EXPLAIN |
| 82 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 83 |
|
| 84 |
explain select 1; |
| 85 |
EXPLAIN |
| 86 |
{ |
| 87 |
"query": "/* select#1 */ select 1 AS `1`", |
| 88 |
"operation": "Rows fetched before execution", |
| 89 |
"access_type": "rows_fetched_before_execution", |
| 90 |
"estimated_rows": 1.0, |
| 91 |
"estimated_total_cost": 0.0, |
| 92 |
"estimated_first_row_cost": 0.0 |
| 93 |
} |
| 94 |
set explain_format=default; |
| 95 |
explain select 1; |
| 96 |
EXPLAIN |
| 97 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 98 |
|
| 99 |
explain format=tree select 1; |
| 100 |
EXPLAIN |
| 101 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 102 |
|
| 103 |
set global explain_format=json; |
| 104 |
set explain_format=traditional; |
| 105 |
explain select 1; |
| 106 |
EXPLAIN |
| 107 |
-> Rows fetched before execution (cost=0..0 rows=1) |
| 108 |
|
| 109 |
set explain_format=traditional; |
| 110 |
explain analyze select 1; |
| 111 |
EXPLAIN |
| 112 |
-> Rows fetched before execution (cost=0..0 rows=1) (actual rows=1 loops=1) |
| 113 |
|
| 114 |
set explain_format=traditional_strict; |
| 115 |
explain analyze select 1; |
| 116 |
EXPLAIN |
| 117 |
-> Rows fetched before execution (cost=0..0 rows=1) (actual rows=1 loops=1) |
| 118 |
|
| 119 |
explain analyze format=traditional select 1; |
| 120 |
ERROR 42000: This version of MySQL doesn't yet support 'EXPLAIN ANALYZE with TRADITIONAL format' |
| 121 |
explain format=traditional_strict select 1; |
| 122 |
ERROR HY000: Unknown EXPLAIN format name: 'traditional_strict' |
| 123 |
set global explain_format=@orig_explain_format; |
| 124 |
select @@explain_format, @@global.explain_format; |
| 125 |
@@explain_format @@global.explain_format |
| 126 |
TRADITIONAL_STRICT TRADITIONAL_STRICT |