Commit b3ab3105 authored by Monty's avatar Monty

Removed double calls to records_in_range from distinct and group by

Fixed by moving testing of get_best_group_min_max() after range testing.
parent f36ca142
...@@ -1387,6 +1387,13 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { ...@@ -1387,6 +1387,13 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
},
"group_index_range": { "group_index_range": {
"potential_group_range_indexes": [ "potential_group_range_indexes": [
{ {
...@@ -1411,13 +1418,6 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { ...@@ -1411,13 +1418,6 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"ranges": ["(2,3) <= (b,c) <= (2,3)"], "ranges": ["(2,3) <= (b,c) <= (2,3)"],
"chosen": false, "chosen": false,
"cause": "cost" "cause": "cost"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
} }
} }
}, },
...@@ -1598,6 +1598,13 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { ...@@ -1598,6 +1598,13 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
},
"group_index_range": { "group_index_range": {
"potential_group_range_indexes": [ "potential_group_range_indexes": [
{ {
...@@ -1622,13 +1629,6 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { ...@@ -1622,13 +1629,6 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
"ranges": ["(2001-01-04) <= (a)"], "ranges": ["(2001-01-04) <= (a)"],
"chosen": false, "chosen": false,
"cause": "cost" "cause": "cost"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
} }
} }
}, },
...@@ -1789,6 +1789,13 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { ...@@ -1789,6 +1789,13 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
},
"group_index_range": { "group_index_range": {
"potential_group_range_indexes": [ "potential_group_range_indexes": [
{ {
...@@ -1813,13 +1820,6 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { ...@@ -1813,13 +1820,6 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
"ranges": ["(2001-01-04) <= (a) <= (2001-01-04)"], "ranges": ["(2001-01-04) <= (a) <= (2001-01-04)"],
"chosen": false, "chosen": false,
"cause": "cost" "cause": "cost"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [],
"analyzing_roworder_intersect": {
"cause": "too few roworder scans"
},
"analyzing_index_merge_union": []
} }
} }
}, },
...@@ -2031,10 +2031,6 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { ...@@ -2031,10 +2031,6 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
} }
], ],
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -2063,6 +2059,10 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { ...@@ -2063,6 +2059,10 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
...@@ -2213,10 +2213,6 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { ...@@ -2213,10 +2213,6 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
} }
], ],
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -2235,6 +2231,10 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { ...@@ -2235,6 +2231,10 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
...@@ -3199,10 +3199,6 @@ explain select * from t1 where pk = 2 and a=5 and b=1 { ...@@ -3199,10 +3199,6 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -3271,6 +3267,10 @@ explain select * from t1 where pk = 2 and a=5 and b=1 { ...@@ -3271,6 +3267,10 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
...@@ -3681,10 +3681,6 @@ explain delete from t0 where t0.a<3 { ...@@ -3681,10 +3681,6 @@ explain delete from t0 where t0.a<3 {
} }
], ],
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no join"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -3700,6 +3696,10 @@ explain delete from t0 where t0.a<3 { ...@@ -3700,6 +3696,10 @@ explain delete from t0 where t0.a<3 {
], ],
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "no join"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
...@@ -3824,10 +3824,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -3824,10 +3824,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "not single_table"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -3846,6 +3842,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -3846,6 +3842,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "not single_table"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
...@@ -3889,10 +3889,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -3889,10 +3889,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"chosen": true "chosen": true
}, },
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "not single_table"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -3911,6 +3907,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -3911,6 +3907,10 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "not single_table"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
......
...@@ -93,10 +93,6 @@ explain select * from t1 where a=1 or b=1 { ...@@ -93,10 +93,6 @@ explain select * from t1 where a=1 or b=1 {
} }
], ],
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [], "range_scan_alternatives": [],
"analyzing_roworder_intersect": { "analyzing_roworder_intersect": {
...@@ -168,6 +164,10 @@ explain select * from t1 where a=1 or b=1 { ...@@ -168,6 +164,10 @@ explain select * from t1 where a=1 or b=1 {
} }
] ]
}, },
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "index_roworder_union", "type": "index_roworder_union",
......
...@@ -108,10 +108,6 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -108,10 +108,6 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
} }
], ],
"setup_range_conditions": [], "setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"analyzing_range_alternatives": { "analyzing_range_alternatives": {
"range_scan_alternatives": [ "range_scan_alternatives": [
{ {
...@@ -158,6 +154,10 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -158,6 +154,10 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
}, },
"analyzing_index_merge_union": [] "analyzing_index_merge_union": []
}, },
"group_index_range": {
"chosen": false,
"cause": "no group by or distinct"
},
"chosen_range_access_summary": { "chosen_range_access_summary": {
"range_access_plan": { "range_access_plan": {
"type": "range_scan", "type": "range_scan",
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment