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