Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
111a752b
Commit
111a752b
authored
Jan 04, 2023
by
Weijun-H
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19160 JSON_DETAILED output unnecessarily verbose
parent
fb0808c4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
327 additions
and
279 deletions
+327
-279
mysql-test/main/func_json.result
mysql-test/main/func_json.result
+126
-0
mysql-test/main/func_json.test
mysql-test/main/func_json.test
+100
-0
mysql-test/main/opt_trace.result
mysql-test/main/opt_trace.result
+43
-175
mysql-test/main/opt_trace_index_merge.result
mysql-test/main/opt_trace_index_merge.result
+18
-84
mysql-test/main/opt_trace_ucs2.result
mysql-test/main/opt_trace_ucs2.result
+2
-7
mysql-test/main/range_notembedded.result
mysql-test/main/range_notembedded.result
+0
-1
mysql-test/suite/plugins/r/multiauth.result
mysql-test/suite/plugins/r/multiauth.result
+0
-3
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+38
-9
No files found.
mysql-test/main/func_json.result
View file @
111a752b
...
...
@@ -1133,3 +1133,129 @@ DROP TABLE t1;
#
# End of 10.4 tests
#
#
# MDEV-19160 JSON_DETAILED output unnecessarily verbose
#
create table t200 (a text);
insert into t200 values
('{
"steps": [
{
"join_optimization": {
"select_id": 1,
"steps": [
{
"rows_estimation": [
{
"table": "t1",
"range_analysis": {
"table_scan": {
"rows": 1000,
"cost": 2e308
},
"potential_range_indexes": [
{
"index": "a_b",
"usable": true,
"key_parts": ["a", "b"]
}
],
"best_covering_index_scan": {
"index": "a_b",
"cost": 52.195,
"chosen": true
},
"setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "a_b",
"ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
"rows": 1,
"cost": 1.1752,
"chosen": true
}
],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": [],
"test_one_line_array":["123"]
},
"chosen_range_access_summary": {
"range_access_plan": {
"type": "range_scan",
"index": "a_b",
"rows": 1,
"ranges": ["2 <= a <= 2 AND 4 <= b <= 4"]
},
"rows_for_plan": 1,
"cost_for_plan": 1.1752,
"chosen": true
}
}
},
{
"selectivity_for_indexes": [
{
"index_name": "a_b",
"selectivity_from_index": 0.001
}
],
"selectivity_for_columns": [],
"cond_selectivity": 0.001
}
]
}
]
}
},
{
"join_execution": {
"select_id": 1,
"steps": []
}
}
]
}');
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a_b",
"ranges":
[
"2 <= a <= 2 AND 4 <= b <= 4",
"123"
],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
"rows": 1,
"cost": 1.1752,
"chosen": true
}
],
"analyzing_roworder_intersect":
{
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[],
"test_one_line_array":
["123"]
}
]
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
[{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}]
mysql-test/main/func_json.test
View file @
111a752b
...
...
@@ -718,3 +718,103 @@ DROP TABLE t1;
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
--
echo
#
--
echo
# MDEV-19160 JSON_DETAILED output unnecessarily verbose
--
echo
#
create
table
t200
(
a
text
);
insert
into
t200
values
(
'{
"steps": [
{
"join_optimization": {
"select_id": 1,
"steps": [
{
"rows_estimation": [
{
"table": "t1",
"range_analysis": {
"table_scan": {
"rows": 1000,
"cost": 2e308
},
"potential_range_indexes": [
{
"index": "a_b",
"usable": true,
"key_parts": ["a", "b"]
}
],
"best_covering_index_scan": {
"index": "a_b",
"cost": 52.195,
"chosen": true
},
"setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "a_b",
"ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
"rows": 1,
"cost": 1.1752,
"chosen": true
}
],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": [],
"test_one_line_array":["123"]
},
"chosen_range_access_summary": {
"range_access_plan": {
"type": "range_scan",
"index": "a_b",
"rows": 1,
"ranges": ["2 <= a <= 2 AND 4 <= b <= 4"]
},
"rows_for_plan": 1,
"cost_for_plan": 1.1752,
"chosen": true
}
}
},
{
"selectivity_for_indexes": [
{
"index_name": "a_b",
"selectivity_from_index": 0.001
}
],
"selectivity_for_columns": [],
"cond_selectivity": 0.001
}
]
}
]
}
},
{
"join_execution": {
"select_id": 1,
"steps": []
}
}
]
}'
);
select
JSON_DETAILED
(
JSON_EXTRACT
(
a
,
'$**.analyzing_range_alternatives'
))
from
t200
;
select
JSON_LOOSE
(
JSON_EXTRACT
(
a
,
'$**.analyzing_range_alternatives'
))
from
t200
;
mysql-test/main/opt_trace.result
View file @
111a752b
...
...
@@ -7459,17 +7459,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a_b",
"ranges":
[
"(2,4) <= (a,b) <= (2,4)"
],
["(2,4) <= (a,b) <= (2,4)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
...
...
@@ -7483,8 +7479,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
explain select * from t1 where a >= 900 and b between 10 and 20;
...
...
@@ -7493,17 +7488,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a_b",
"ranges":
[
"(900,10) <= (a,b)"
],
["(900,10) <= (a,b)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": true,
...
...
@@ -7517,8 +7508,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t0,t1;
...
...
@@ -7530,17 +7520,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "start_date",
"ranges":
[
"(2019-02-10,NULL) < (start_date,end_date)"
],
["(2019-02-10,NULL) < (start_date,end_date)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -7554,8 +7540,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1,one_k;
...
...
@@ -7575,17 +7560,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a_b_c",
"ranges":
[
"(1) <= (a,b) < (4,50)"
],
["(1) <= (a,b) < (4,50)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -7599,8 +7580,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table ten,t1;
...
...
@@ -7614,17 +7594,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C) <= (b) <= (\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C)"
],
["(\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C) <= (b) <= (\xD9[\x943j\x99F\xA3\x9C\xF5\xB5\x8C\xFEw-\x8C)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7638,8 +7614,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
EXPLAIN SELECT * FROM t1 WHERE b IS NULL;
...
...
@@ -7648,17 +7623,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(NULL) <= (b) <= (NULL)"
],
["(NULL) <= (b) <= (NULL)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7672,8 +7643,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
...
...
@@ -7690,17 +7660,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\x0A) <= (b) <= (ab\x0A)"
],
["(ab\x0A) <= (b) <= (ab\x0A)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7714,8 +7680,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
ALTER TABLE t1 modify column b BINARY(10) AFTER i;
...
...
@@ -7725,17 +7690,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\x0A\x00\x00\x00\x00\x00\x00\x00) <= (b) <= (ab\x0A\x00\x00\x00\x00\x00\x00\x00)"
],
["(ab\x0A\x00\x00\x00\x00\x00\x00\x00) <= (b) <= (ab\x0A\x00\x00\x00\x00\x00\x00\x00)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7749,8 +7710,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
ALTER TABLE t1 modify column b VARBINARY(10) AFTER i;
...
...
@@ -7760,17 +7720,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\x0A) <= (b) <= (ab\x0A)"
],
["(ab\x0A) <= (b) <= (ab\x0A)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7784,8 +7740,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
...
...
@@ -7798,17 +7753,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\n) <= (b) <= (ab\n)"
],
["(ab\n) <= (b) <= (ab\n)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7822,8 +7773,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
...
...
@@ -7839,17 +7789,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\x0A) <= (b) <= (ab\x0A)"
],
["(ab\x0A) <= (b) <= (ab\x0A)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -7863,8 +7809,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
...
...
@@ -7878,17 +7823,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "i_b",
"ranges":
[
"(ab\n) <= (b) <= (ab\n)"
],
["(ab\n) <= (b) <= (ab\n)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -7902,8 +7843,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
...
...
@@ -7934,17 +7874,13 @@ EXPLAIN
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "start_date",
"ranges":
[
"(2019-02-10,NULL) < (start_date,end_date)"
],
["(2019-02-10,NULL) < (start_date,end_date)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -7958,8 +7894,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1, t0, one_k;
...
...
@@ -7998,19 +7933,15 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[
[
{
"plan_prefix":
[
],
[],
"table": "A",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 5.9375,
...
...
@@ -8030,18 +7961,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost_for_plan": 4.0171,
"rest_of_plan":
[
{
"plan_prefix":
[
"A"
],
["A"],
"table": "B",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 804.69,
...
...
@@ -8063,17 +7990,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
}
]
},
{
"plan_prefix":
[
],
[],
"table": "B",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 804.69,
...
...
@@ -8104,19 +8028,15 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[
[
{
"plan_prefix":
[
],
[],
"table": "A",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 10,
...
...
@@ -8136,18 +8056,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost_for_plan": 4.0171,
"rest_of_plan":
[
{
"plan_prefix":
[
"A"
],
["A"],
"table": "B",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "ref",
"index": "b",
...
...
@@ -8158,7 +8074,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost": 20,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 804.69,
...
...
@@ -8181,17 +8096,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
}
]
},
{
"plan_prefix":
[
],
[],
"table": "B",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 804.69,
...
...
@@ -8227,17 +8139,13 @@ a
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a",
"ranges":
[
"() <= (a) <= ()"
],
["() <= (a) <= ()"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -8251,8 +8159,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
DROP TABLE t1;
...
...
@@ -8274,7 +8181,6 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout'))
[
{
"pulled_out_tables":
[
...
...
@@ -8295,15 +8201,11 @@ kp1 kp2
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
[
[
{
"index": "kp1",
"ranges":
[
"(2,4) <= (kp1,kp2) <= (2)"
],
["(2,4) <= (kp1,kp2) <= (2)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": true,
...
...
@@ -8330,19 +8232,15 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
[
[
{
"plan_prefix":
[
],
[],
"table": "t1",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 10,
...
...
@@ -8362,18 +8260,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost_for_plan": 4.022,
"rest_of_plan":
[
{
"plan_prefix":
[
"t1"
],
["t1"],
"table": "t2",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "ref",
"index": "a",
...
...
@@ -8384,7 +8278,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost": 20,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 100,
...
...
@@ -8407,17 +8300,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
}
]
},
{
"plan_prefix":
[
],
[],
"table": "t2",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "scan",
"resulting_rows": 100,
...
...
@@ -8438,18 +8328,14 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost_for_plan": 22.22,
"rest_of_plan":
[
{
"plan_prefix":
[
"t2"
],
["t2"],
"table": "t1",
"best_access_path":
{
"considered_access_paths":
[
{
"access_type": "ref",
"index": "a",
...
...
@@ -8460,7 +8346,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"cost": 200,
"chosen": true
},
{
"access_type": "scan",
"resulting_rows": 10,
...
...
@@ -8504,24 +8389,17 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns'))
[
[
{
"column_name": "a",
"ranges":
[
"1 <= a <= 5"
],
["1 <= a <= 5"],
"selectivity_from_histogram": 0.0469
},
{
"column_name": "b",
"ranges":
[
"NULL < b <= 5"
],
["NULL < b <= 5"],
"selectivity_from_histogram": 0.0469
}
]
...
...
@@ -8534,9 +8412,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns'))
[
[
{
"column_name": "a",
"ranges":
...
...
@@ -8556,15 +8432,11 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns'))
[
[
{
"column_name": "b",
"ranges":
[
"10 <= b < 25"
],
["10 <= b < 25"],
"selectivity_from_histogram": 0.1562
}
]
...
...
@@ -8582,15 +8454,11 @@ UPDATE t1 SET b=10 WHERE a=1;
SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
[
[
{
"index": "PRIMARY",
"ranges":
[
"(1) <= (a) <= (1)"
],
["(1) <= (a) <= (1)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
mysql-test/main/opt_trace_index_merge.result
View file @
111a752b
...
...
@@ -307,17 +307,13 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "key1",
"ranges":
[
"(100) <= (key1) <= (100)"
],
["(100) <= (key1) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -325,13 +321,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cost": 2844.1,
"chosen": true
},
{
"index": "key2",
"ranges":
[
"(100) <= (key2) <= (100)"
],
["(100) <= (key2) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -340,13 +333,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"chosen": false,
"cause": "cost"
},
{
"index": "key3",
"ranges":
[
"(100) <= (key3) <= (100)"
],
["(100) <= (key3) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
...
...
@@ -360,7 +350,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
{
"intersecting_indexes":
[
{
"index": "key1",
"index_scan_cost": 58.252,
...
...
@@ -372,7 +361,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"intersect_covering_with_this_index": false,
"chosen": true
},
{
"index": "key2",
"index_scan_cost": 58.252,
...
...
@@ -384,7 +372,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"intersect_covering_with_this_index": false,
"chosen": true
},
{
"index": "key3",
"index_scan_cost": 58.252,
...
...
@@ -408,14 +395,12 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"chosen": true
},
"analyzing_index_merge_union":
[
]
[]
}
]
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
[
{
"range_access_plan":
{
...
...
@@ -426,35 +411,26 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
"clustered_pk_scan": false,
"intersect_of":
[
{
"type": "range_scan",
"index": "key1",
"rows": 2243,
"ranges":
[
"(100) <= (key1) <= (100)"
]
["(100) <= (key1) <= (100)"]
},
{
"type": "range_scan",
"index": "key2",
"rows": 2243,
"ranges":
[
"(100) <= (key2) <= (100)"
]
["(100) <= (key2) <= (100)"]
},
{
"type": "range_scan",
"index": "key3",
"rows": 2243,
"ranges":
[
"(100) <= (key3) <= (100)"
]
["(100) <= (key3) <= (100)"]
}
]
},
...
...
@@ -470,32 +446,25 @@ id select_type table type possible_keys key key_len ref rows Extra
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
],
[],
"analyzing_roworder_intersect":
{
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
{
"indexes_to_merge":
[
{
"range_scan_alternatives":
[
{
"index": "key1",
"ranges":
[
"(100) <= (key1) <= (100)"
],
["(100) <= (key1) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
...
...
@@ -503,13 +472,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cost": 152.53,
"chosen": true
},
{
"index": "key2",
"ranges":
[
"(100) <= (key2) <= (100)"
],
["(100) <= (key2) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
...
...
@@ -522,17 +488,13 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"index_to_merge": "key1",
"cumulated_cost": 152.53
},
{
"range_scan_alternatives":
[
{
"index": "key3",
"ranges":
[
"(100) <= (key3) <= (100)"
],
["(100) <= (key3) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
...
...
@@ -540,13 +502,10 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cost": 152.53,
"chosen": true
},
{
"index": "key4",
"ranges":
[
"(100) <= (key4) <= (100)"
],
["(100) <= (key4) <= (100)"],
"rowid_ordered": true,
"using_mrr": false,
"index_only": true,
...
...
@@ -565,20 +524,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "always cheaper than non roworder retrieval",
"analyzing_roworder_scans":
[
{
"type": "range_scan",
"index": "key1",
"rows": 2243,
"ranges":
[
"(100) <= (key1) <= (100)"
],
["(100) <= (key1) <= (100)"],
"analyzing_roworder_intersect":
{
"intersecting_indexes":
[
{
"index": "key1",
"index_scan_cost": 58.252,
...
...
@@ -590,7 +545,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"intersect_covering_with_this_index": false,
"chosen": true
},
{
"index": "key2",
"index_scan_cost": 58.252,
...
...
@@ -614,20 +568,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"chosen": true
}
},
{
"type": "range_scan",
"index": "key3",
"rows": 2243,
"ranges":
[
"(100) <= (key3) <= (100)"
],
["(100) <= (key3) <= (100)"],
"analyzing_roworder_intersect":
{
"intersecting_indexes":
[
{
"index": "key3",
"index_scan_cost": 58.252,
...
...
@@ -639,7 +589,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"intersect_covering_with_this_index": false,
"chosen": true
},
{
"index": "key4",
"index_scan_cost": 58.252,
...
...
@@ -674,14 +623,12 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
[
{
"range_access_plan":
{
"type": "index_roworder_union",
"union_of":
[
{
"type": "index_roworder_intersect",
"rows": 77,
...
...
@@ -690,29 +637,22 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
"clustered_pk_scan": false,
"intersect_of":
[
{
"type": "range_scan",
"index": "key1",
"rows": 2243,
"ranges":
[
"(100) <= (key1) <= (100)"
]
["(100) <= (key1) <= (100)"]
},
{
"type": "range_scan",
"index": "key2",
"rows": 2243,
"ranges":
[
"(100) <= (key2) <= (100)"
]
["(100) <= (key2) <= (100)"]
}
]
},
{
"type": "index_roworder_intersect",
"rows": 77,
...
...
@@ -721,25 +661,19 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
"clustered_pk_scan": false,
"intersect_of":
[
{
"type": "range_scan",
"index": "key3",
"rows": 2243,
"ranges":
[
"(100) <= (key3) <= (100)"
]
["(100) <= (key3) <= (100)"]
},
{
"type": "range_scan",
"index": "key4",
"rows": 2243,
"ranges":
[
"(100) <= (key4) <= (100)"
]
["(100) <= (key4) <= (100)"]
}
]
}
...
...
mysql-test/main/opt_trace_ucs2.result
View file @
111a752b
...
...
@@ -23,17 +23,13 @@ EXPLAIN
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "col1",
"ranges":
[
"(a) <= (col1)"
],
["(a) <= (col1)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
...
...
@@ -47,8 +43,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
[]
}
]
drop table t1;
mysql-test/main/range_notembedded.result
View file @
111a752b
...
...
@@ -20,7 +20,6 @@ select json_detailed(JSON_EXTRACT(trace, '$**.ranges'))
from information_schema.optimizer_trace;
json_detailed(JSON_EXTRACT(trace, '$**.ranges'))
[
[
"(1) <= (key1) <= (1)",
"(2) <= (key1) <= (2)",
...
...
mysql-test/suite/plugins/r/multiauth.result
View file @
111a752b
...
...
@@ -110,16 +110,13 @@ json_detailed(priv)
"authentication_string": "*7D8C3DF236D9163B6C274A9D47704BC496988460",
"auth_or":
[
{
"plugin": "ed25519",
"authentication_string": "F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc"
},
{
"plugin": "unix_socket"
},
{
}
],
...
...
sql/item_jsonfunc.cc
View file @
111a752b
...
...
@@ -257,16 +257,22 @@ static int json_nice(json_engine_t *je, String *nice_js,
Item_func_json_format
::
formats
mode
,
int
tab_size
=
4
)
{
int
depth
=
0
;
const
char
*
comma
,
*
colon
;
static
const
char
*
comma
=
", "
,
*
colon
=
"
\"
: "
;
uint
comma_len
,
colon_len
;
int
first_value
=
1
;
DBUG_ASSERT
(
je
->
s
.
cs
==
nice_js
->
charset
());
int
value_size
=
0
;
int
curr_state
=
-
1
;
int64_t
value_len
=
0
;
String
curr_str
{};
nice_js
->
length
(
0
);
nice_js
->
set_charset
(
je
->
s
.
cs
);
nice_js
->
alloc
(
je
->
s
.
str_end
-
je
->
s
.
c_str
+
32
);
DBUG_ASSERT
(
mode
!=
Item_func_json_format
::
DETAILED
||
(
tab_size
>=
0
&&
tab_size
<=
TAB_SIZE_LIMIT
));
comma
=
", "
;
colon
=
"
\"
: "
;
if
(
mode
==
Item_func_json_format
::
LOOSE
)
{
comma_len
=
2
;
...
...
@@ -285,6 +291,7 @@ static int json_nice(json_engine_t *je, String *nice_js,
do
{
curr_state
=
je
->
state
;
switch
(
je
->
state
)
{
case
JST_KEY
:
...
...
@@ -307,7 +314,7 @@ static int json_nice(json_engine_t *je, String *nice_js,
append_tab
(
nice_js
,
depth
,
tab_size
))
goto
error
;
nice_js
->
append
(
"
\"
"
,
1
);
nice_js
->
append
(
'"'
);
append_simple
(
nice_js
,
key_start
,
key_end
-
key_start
);
nice_js
->
append
(
colon
,
colon_len
);
}
...
...
@@ -332,17 +339,23 @@ static int json_nice(json_engine_t *je, String *nice_js,
if
(
append_simple
(
nice_js
,
je
->
value_begin
,
je
->
value_end
-
je
->
value_begin
))
goto
error
;
curr_str
.
copy
((
const
char
*
)
je
->
value_begin
,
je
->
value_end
-
je
->
value_begin
,
je
->
s
.
cs
);
value_len
=
je
->
value_end
-
je
->
value_begin
;
first_value
=
0
;
if
(
value_size
!=
-
1
)
value_size
++
;
}
else
{
if
(
mode
==
Item_func_json_format
::
DETAILED
&&
depth
>
0
&&
depth
>
0
&&
!
(
curr_state
!=
JST_KEY
)
&&
append_tab
(
nice_js
,
depth
,
tab_size
))
goto
error
;
nice_js
->
append
((
je
->
value_type
==
JSON_VALUE_OBJECT
)
?
"{"
:
"["
,
1
);
first_value
=
1
;
value_size
=
(
je
->
value_type
==
JSON_VALUE_OBJECT
)
?
-
1
:
0
;
depth
++
;
}
...
...
@@ -351,11 +364,27 @@ static int json_nice(json_engine_t *je, String *nice_js,
case
JST_OBJ_END
:
case
JST_ARRAY_END
:
depth
--
;
if
(
mode
==
Item_func_json_format
::
DETAILED
&&
if
(
mode
==
Item_func_json_format
::
DETAILED
&&
(
value_size
>
1
||
value_size
==
-
1
)
&&
append_tab
(
nice_js
,
depth
,
tab_size
))
goto
error
;
if
(
mode
==
Item_func_json_format
::
DETAILED
&&
value_size
==
1
&&
je
->
state
!=
JST_OBJ_END
)
{
for
(
auto
i
=
0
;
i
<
value_len
;
i
++
)
{
nice_js
->
chop
();
}
for
(
auto
i
=
0
;
i
<
(
depth
+
1
)
*
tab_size
+
1
;
i
++
)
{
nice_js
->
chop
();
}
nice_js
->
append
(
curr_str
);
}
nice_js
->
append
((
je
->
state
==
JST_OBJ_END
)
?
"}"
:
"]"
,
1
);
first_value
=
0
;
value_size
=
-
1
;
break
;
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment