mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
87 lines
2 KiB
Text
87 lines
2 KiB
Text
#
|
|
# MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins
|
|
#
|
|
#
|
|
# First, check a regular BNL-join
|
|
#
|
|
create table t1 (
|
|
a int,
|
|
b int
|
|
);
|
|
insert into t1 select seq, seq/3 from seq_0_to_99;
|
|
create table t2 (
|
|
a int,
|
|
b int
|
|
);
|
|
insert into t2 select seq, seq/5 from seq_0_to_99;
|
|
set @js='$out';
|
|
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
|
|
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
|
|
cast(json_extract(@out,'$[0]') as DOUBLE) > 0
|
|
1
|
|
drop table t1,t2;
|
|
#
|
|
# Now, check the hashed, BNL-H join
|
|
#
|
|
create table t1 (
|
|
a int,
|
|
b int
|
|
);
|
|
insert into t1 select seq, seq/3 from seq_0_to_499;
|
|
create table t2 (
|
|
a int,
|
|
b int
|
|
);
|
|
insert into t2 select seq, seq/5 from seq_0_to_499;
|
|
set @tmp=@@join_cache_level, join_cache_level=6;
|
|
select '$out' as X;
|
|
X
|
|
{
|
|
"query_block": {
|
|
"select_id": 1,
|
|
"r_loops": 1,
|
|
"r_total_time_ms": "REPLACED",
|
|
"table": {
|
|
"table_name": "t1",
|
|
"access_type": "ALL",
|
|
"r_loops": 1,
|
|
"rows": 500,
|
|
"r_rows": 500,
|
|
"r_table_time_ms": "REPLACED",
|
|
"r_other_time_ms": "REPLACED",
|
|
"filtered": 100,
|
|
"r_filtered": 100,
|
|
"attached_condition": "t1.a < 700 and t1.b is not null"
|
|
},
|
|
"block-nl-join": {
|
|
"table": {
|
|
"table_name": "t2",
|
|
"access_type": "hash_ALL",
|
|
"key": "#hash#$hj",
|
|
"key_length": "5",
|
|
"used_key_parts": ["b"],
|
|
"ref": ["test.t1.b"],
|
|
"r_loops": 1,
|
|
"rows": 500,
|
|
"r_rows": 500,
|
|
"r_table_time_ms": "REPLACED",
|
|
"r_other_time_ms": "REPLACED",
|
|
"filtered": 100,
|
|
"r_filtered": 20,
|
|
"attached_condition": "t2.a < 100"
|
|
},
|
|
"buffer_type": "flat",
|
|
"buffer_size": "18Kb",
|
|
"join_type": "BNLH",
|
|
"attached_condition": "t2.b = t1.b",
|
|
"r_filtered": 100,
|
|
"r_unpack_time_ms": "REPLACED"
|
|
}
|
|
}
|
|
}
|
|
set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
|
|
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
|
|
cast(json_extract(@out,'$[0]') as DOUBLE) > 0
|
|
1
|
|
set join_cache_level=@tmp;
|
|
drop table t1, t2;
|