mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Merge 10.4 into 10.5
This commit is contained in:
commit
6877ef9a7c
61 changed files with 841 additions and 477 deletions
|
|
@ -441,6 +441,7 @@ select * from v2 {
|
|||
},
|
||||
"rows_for_plan": 1,
|
||||
"cost_for_plan": 2.404394531,
|
||||
"cost_for_sorting": 1,
|
||||
"estimated_join_cardinality": 1
|
||||
}
|
||||
]
|
||||
|
|
@ -765,6 +766,7 @@ explain select * from v1 {
|
|||
},
|
||||
"rows_for_plan": 10,
|
||||
"cost_for_plan": 4.021972656,
|
||||
"cost_for_sorting": 10,
|
||||
"estimated_join_cardinality": 10
|
||||
}
|
||||
]
|
||||
|
|
@ -1452,6 +1454,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
|
|||
},
|
||||
"rows_for_plan": 8,
|
||||
"cost_for_plan": 3.8,
|
||||
"cost_for_sorting": 8,
|
||||
"estimated_join_cardinality": 8
|
||||
}
|
||||
]
|
||||
|
|
@ -1645,6 +1648,7 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
|
|||
},
|
||||
"rows_for_plan": 9,
|
||||
"cost_for_plan": 4.15,
|
||||
"cost_for_sorting": 9,
|
||||
"estimated_join_cardinality": 9
|
||||
}
|
||||
]
|
||||
|
|
@ -1827,6 +1831,7 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
|
|||
},
|
||||
"rows_for_plan": 9,
|
||||
"cost_for_plan": 4.15,
|
||||
"cost_for_sorting": 9,
|
||||
"estimated_join_cardinality": 9
|
||||
}
|
||||
]
|
||||
|
|
@ -8258,6 +8263,174 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
|
|||
]
|
||||
]
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-21626: Optimizer misses the details about the picked join order
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT, key(a));
|
||||
INSERT INTO t1 SELECT seq, seq from seq_1_to_10;
|
||||
CREATE TABLE t2(a INT, b INT, key(a));
|
||||
INSERT INTO t2 SELECT seq, seq from seq_1_to_100;
|
||||
SET OPTIMIZER_TRACE=1;
|
||||
EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL a NULL NULL NULL 10 Using where; Using temporary; Using filesort
|
||||
1 SIMPLE t2 ref a a 5 test.t1.a 1
|
||||
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,
|
||||
"cost": 2.021972656,
|
||||
"chosen": true
|
||||
}
|
||||
],
|
||||
"chosen_access_method":
|
||||
{
|
||||
"type": "scan",
|
||||
"records": 10,
|
||||
"cost": 2.021972656,
|
||||
"uses_join_buffering": false
|
||||
}
|
||||
},
|
||||
"rows_for_plan": 10,
|
||||
"cost_for_plan": 4.021972656,
|
||||
"rest_of_plan":
|
||||
[
|
||||
|
||||
{
|
||||
"plan_prefix":
|
||||
[
|
||||
"t1"
|
||||
],
|
||||
"table": "t2",
|
||||
"best_access_path":
|
||||
{
|
||||
"considered_access_paths":
|
||||
[
|
||||
|
||||
{
|
||||
"access_type": "ref",
|
||||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rows": 1,
|
||||
"cost": 20.00585794,
|
||||
"chosen": true
|
||||
},
|
||||
|
||||
{
|
||||
"access_type": "scan",
|
||||
"resulting_rows": 100,
|
||||
"cost": 2.219726562,
|
||||
"chosen": false
|
||||
}
|
||||
],
|
||||
"chosen_access_method":
|
||||
{
|
||||
"type": "ref",
|
||||
"records": 1,
|
||||
"cost": 20.00585794,
|
||||
"uses_join_buffering": false
|
||||
}
|
||||
},
|
||||
"rows_for_plan": 10,
|
||||
"cost_for_plan": 26.0278306,
|
||||
"cost_for_sorting": 10,
|
||||
"estimated_join_cardinality": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"plan_prefix":
|
||||
[
|
||||
],
|
||||
"table": "t2",
|
||||
"best_access_path":
|
||||
{
|
||||
"considered_access_paths":
|
||||
[
|
||||
|
||||
{
|
||||
"access_type": "scan",
|
||||
"resulting_rows": 100,
|
||||
"cost": 2.219726562,
|
||||
"chosen": true,
|
||||
"use_tmp_table": true
|
||||
}
|
||||
],
|
||||
"chosen_access_method":
|
||||
{
|
||||
"type": "scan",
|
||||
"records": 100,
|
||||
"cost": 2.219726562,
|
||||
"uses_join_buffering": false
|
||||
}
|
||||
},
|
||||
"rows_for_plan": 100,
|
||||
"cost_for_plan": 22.21972656,
|
||||
"rest_of_plan":
|
||||
[
|
||||
|
||||
{
|
||||
"plan_prefix":
|
||||
[
|
||||
"t2"
|
||||
],
|
||||
"table": "t1",
|
||||
"best_access_path":
|
||||
{
|
||||
"considered_access_paths":
|
||||
[
|
||||
|
||||
{
|
||||
"access_type": "ref",
|
||||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rows": 1,
|
||||
"cost": 200.0585794,
|
||||
"chosen": true
|
||||
},
|
||||
|
||||
{
|
||||
"access_type": "scan",
|
||||
"resulting_rows": 10,
|
||||
"cost": 2.021972656,
|
||||
"chosen": true
|
||||
}
|
||||
],
|
||||
"chosen_access_method":
|
||||
{
|
||||
"type": "scan",
|
||||
"records": 10,
|
||||
"cost": 2.021972656,
|
||||
"uses_join_buffering": true
|
||||
}
|
||||
},
|
||||
"rows_for_plan": 1000,
|
||||
"cost_for_plan": 224.2416992,
|
||||
"pruned_by_cost": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
DROP TABLE t1,t2;
|
||||
# End of 10.4 tests
|
||||
#
|
||||
# Test many rows to see output of big cost numbers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue