1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge mariadb-11.0.2 into 11.0

This commit is contained in:
Marko Mäkelä
2023-06-08 11:35:36 +03:00
429 changed files with 4171 additions and 1742 deletions

View File

@ -514,6 +514,11 @@ select * from v2 {
}
]
},
{
"check_split_materialized": {
"not_applicable": "no candidate field can be accessed through ref"
}
},
{
"best_join_order": ["t1"],
"rows": 1,
@ -900,6 +905,11 @@ explain select * from v1 {
}
]
},
{
"check_split_materialized": {
"not_applicable": "group list has no candidates"
}
},
{
"best_join_order": ["t1"],
"rows": 10,
@ -12045,6 +12055,116 @@ SET optimizer_trace=DEFAULT;
DROP VIEW v;
DROP TABLE t;
#
# MDEV-26301: Split optimization improvements: Optimizer Trace coverage
#
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status Table is already up to date
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
set optimizer_trace=1;
explain
select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
from information_schema.optimizer_trace;
JS
[
{
"split_candidates":
["t10.grp_id"]
}
]
select
json_detailed(
json_remove(
json_extract(trace, '$**.choose_best_splitting')
, '$[0].split_plan_search[0]'
)
) as JS
from information_schema.optimizer_trace;
JS
[
{
"considered_keys":
[
{
"table_name": "t10",
"index": "grp_id",
"rec_per_key": 100,
"param_tables": 1
}
],
"refills": 5,
"spl_pd_boundary": 2,
"split_plan_search":
[],
"split_materialized":
{
"table": "t10",
"key": "grp_id",
"org_cost": 1.159965,
"postjoin_cost": 4.020888502,
"one_splitting_cost": 5.180853502,
"unsplit_postjoin_cost": 32.78652054,
"unsplit_cost": 148.7830205,
"rows": 100,
"refills": 5,
"total_splitting_cost": 25.90426751,
"chosen": true
}
}
]
drop table t1,t2,t3,t10,t11;
set optimizer_trace=DEFAULT;
#
# End of 10.4 tests
#
set optimizer_trace='enabled=on';
@ -12476,84 +12596,94 @@ from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.choose_best_splitting'))
[
[
{
"considered_execution_plans":
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"best_access_path":
{
"considered_keys":
[]
},
{
"considered_keys":
[
{
"table_name": "t2",
"index": "idx_a",
"rec_per_key": 1.8367,
"param_tables": 1
}
],
"refills": 4,
"spl_pd_boundary": 2,
"split_plan_search":
[
{
"considered_execution_plans":
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"table": "t2",
"plan_details":
"best_access_path":
{
"record_count": 1
},
"considered_access_paths":
[
"table": "t2",
"plan_details":
{
"access_type": "ref",
"index": "idx_a",
"used_range_estimates": false,
"reason": "not available",
"rows": 1.8367,
"cost": 0.002051185,
"chosen": true
"record_count": 1
},
"considered_access_paths":
[
{
"access_type": "ref",
"index": "idx_a",
"used_range_estimates": false,
"reason": "not available",
"rows": 1.8367,
"cost": 0.002051185,
"chosen": true
},
{
"type": "scan",
"chosen": false,
"cause": "cost"
}
],
"chosen_access_method":
{
"type": "scan",
"chosen": false,
"cause": "cost"
"type": "ref",
"rows_read": 1.8367,
"rows_out": 1.8367,
"cost": 0.002051185,
"uses_join_buffering": false
}
],
"chosen_access_method":
{
"type": "ref",
"rows_read": 1.8367,
"rows_out": 1.8367,
"cost": 0.002051185,
"uses_join_buffering": false
}
}
}
]
},
{
"plan_prefix": "",
"table": "t2",
"rows_for_plan": 1.8367,
"cost_for_plan": 0.002051185,
"cost_for_sorting": 0.001155201
}
]
},
{
"split_materialized":
{
"table": "t2",
"key": "idx_a",
"org_cost": 0.002051185,
"postjoin_cost": 0.001135418,
"one_splitting_cost": 0.003186603,
"unsplit_postjoin_cost": 0.036032575,
"unsplit_cost": 0.060625425,
"rows": 1.8367,
"outer_rows": 4,
"total_splitting_cost": 0.012746412,
"chosen": true
]
},
{
"plan_prefix": "",
"table": "t2",
"rows_for_plan": 1.8367,
"cost_for_plan": 0.002051185,
"cost_for_sorting": 0.001155201
}
]
}
],
"split_materialized":
{
"table": "t2",
"key": "idx_a",
"org_cost": 0.002051185,
"postjoin_cost": 0.001135418,
"one_splitting_cost": 0.003186603,
"unsplit_postjoin_cost": 0.036032575,
"unsplit_cost": 0.060625425,
"rows": 1.8367,
"refills": 4,
"total_splitting_cost": 0.012746412,
"chosen": true
}
]
}
]
select
json_detailed(json_extract(trace, '$**.lateral_derived'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.lateral_derived'))
NULL
drop table t1,t2;
#
# Test table functions.