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
68542cae
Commit
68542cae
authored
Oct 18, 2023
by
Oleg Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-32475 Add logging of test_if_skip_sort_order to optimizer trace
parent
680f732f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
134 deletions
+165
-134
mysql-test/main/opt_trace.result
mysql-test/main/opt_trace.result
+159
-134
sql/sql_select.cc
sql/sql_select.cc
+6
-0
No files found.
mysql-test/main/opt_trace.result
View file @
68542cae
...
...
@@ -468,6 +468,9 @@ select * from v2 {
}
]
}
},
{
"test_if_skip_sort_order": []
}
]
}
...
...
@@ -796,6 +799,9 @@ explain select * from v1 {
}
]
}
},
{
"test_if_skip_sort_order": []
}
]
}
...
...
@@ -1290,6 +1296,9 @@ EXPLAIN SELECT DISTINCT a FROM t1 {
}
]
}
},
{
"test_if_skip_sort_order": []
}
]
}
...
...
@@ -1485,23 +1494,27 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
}
},
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 3.3131,
"table": "t1",
"rows_estimation": 7,
"possible_keys": [
{
"index": "a",
"can_resolve_order": true,
"updated_limit": 7,
"index_scan_time": 7,
"records": 7,
"chosen": true
"test_if_skip_sort_order": [
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 3.3131,
"table": "t1",
"rows_estimation": 7,
"possible_keys": [
{
"index": "a",
"can_resolve_order": true,
"updated_limit": 7,
"index_scan_time": 7,
"records": 7,
"chosen": true
}
]
}
]
}
}
]
}
]
}
...
...
@@ -1687,23 +1700,27 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
}
},
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 2.0322,
"table": "t1",
"rows_estimation": 9,
"possible_keys": [
{
"index": "id",
"can_resolve_order": true,
"updated_limit": 16,
"index_scan_time": 16,
"records": 16,
"chosen": true
"test_if_skip_sort_order": [
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 2.0322,
"table": "t1",
"rows_estimation": 9,
"possible_keys": [
{
"index": "id",
"can_resolve_order": true,
"updated_limit": 16,
"index_scan_time": 16,
"records": 16,
"chosen": true
}
]
}
]
}
}
]
}
]
}
...
...
@@ -1878,23 +1895,27 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
}
},
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 2.0322,
"table": "t1",
"rows_estimation": 9,
"possible_keys": [
{
"index": "id",
"can_resolve_order": true,
"updated_limit": 16,
"index_scan_time": 16,
"records": 16,
"chosen": true
"test_if_skip_sort_order": [
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "GROUP BY",
"fanout": 1,
"read_time": 2.0322,
"table": "t1",
"rows_estimation": 9,
"possible_keys": [
{
"index": "id",
"can_resolve_order": true,
"updated_limit": 16,
"index_scan_time": 16,
"records": 16,
"chosen": true
}
]
}
]
}
}
]
}
]
}
...
...
@@ -2176,97 +2197,101 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
}
},
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "ORDER BY",
"fanout": 1,
"read_time": 22.001,
"table": "t1",
"rows_estimation": 21,
"possible_keys": [
{
"index": "a_a",
"can_resolve_order": true,
"updated_limit": 47,
"index_scan_time": 47,
"usable": false,
"cause": "cost"
},
{
"index": "a_c",
"can_resolve_order": true,
"updated_limit": 47,
"range_scan_time": 4.324,
"index_scan_time": 4.324,
"records": 180,
"chosen": true
},
{
"index": "a_b",
"can_resolve_order": false,
"cause": "not usable index for the query"
}
]
}
},
{
"table": "t1",
"range_analysis": {
"table_scan": {
"rows": 1000,
"cost": 2e308
},
"potential_range_indexes": [
{
"index": "a_a",
"usable": false,
"cause": "not applicable"
},
{
"index": "a_c",
"usable": true,
"key_parts": ["a", "c"]
},
{
"index": "a_b",
"usable": false,
"cause": "not applicable"
"test_if_skip_sort_order": [
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "ORDER BY",
"fanout": 1,
"read_time": 22.001,
"table": "t1",
"rows_estimation": 21,
"possible_keys": [
{
"index": "a_a",
"can_resolve_order": true,
"updated_limit": 47,
"index_scan_time": 47,
"usable": false,
"cause": "cost"
},
{
"index": "a_c",
"can_resolve_order": true,
"updated_limit": 47,
"range_scan_time": 4.324,
"index_scan_time": 4.324,
"records": 180,
"chosen": true
},
{
"index": "a_b",
"can_resolve_order": false,
"cause": "not usable index for the query"
}
]
}
],
"setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "a_c",
"ranges": ["(1) <= (a) <= (1)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
"rows": 180,
"cost": 229.72,
{
"table": "t1",
"range_analysis": {
"table_scan": {
"rows": 1000,
"cost": 2e308
},
"potential_range_indexes": [
{
"index": "a_a",
"usable": false,
"cause": "not applicable"
},
{
"index": "a_c",
"usable": true,
"key_parts": ["a", "c"]
},
{
"index": "a_b",
"usable": false,
"cause": "not applicable"
}
],
"setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "a_c",
"ranges": ["(1) <= (a) <= (1)"],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
"rows": 180,
"cost": 229.72,
"chosen": true
}
],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
},
"chosen_range_access_summary": {
"range_access_plan": {
"type": "range_scan",
"index": "a_c",
"rows": 180,
"ranges": ["(1) <= (a) <= (1)"]
},
"rows_for_plan": 180,
"cost_for_plan": 229.72,
"chosen": true
}
],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
},
"chosen_range_access_summary": {
"range_access_plan": {
"type": "range_scan",
"index": "a_c",
"rows": 180,
"ranges": ["(1) <= (a) <= (1)"]
},
"rows_for_plan": 180,
"cost_for_plan": 229.72,
"chosen": true
}
}
}
]
}
]
}
...
...
sql/sql_select.cc
View file @
68542cae
...
...
@@ -23608,8 +23608,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
bool orig_cond_saved= false;
int best_key= -1;
bool changed_key= false;
THD *thd= tab->join->thd;
DBUG_ENTER("test_if_skip_sort_order");
Json_writer_object trace_wrapper(thd);
Json_writer_array trace_arr(thd, "test_if_skip_sort_order");
/* Check that we are always called with first non-const table */
DBUG_ASSERT(tab == tab->join->join_tab + tab->join->const_tables);
...
...
@@ -23618,6 +23622,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
tab->type == JT_CONST ||
tab->type == JT_SYSTEM)
{
Json_writer_object trace_skip(thd);
trace_skip.add("skipped", "single row access method");
DBUG_RETURN(1);
}
...
...
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