-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Engine Merge with Join does not use partition key / primary key #22226
Copy link
Copy link
Closed
Labels
comp-joinsJOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...performance
Description
20.8.14.4
affected all versions after #15228 #15242
create table foo(A Int64, V Int64, S String) Engine=MergeTree partition by V order by A;
insert into foo select number, number%5, '' from numbers(100000);
create table foo_merge as foo ENGINE=Merge(currentDatabase(), '^foo');
select count(), B from foo_merge join
(select materialize('') as S, 5 B) x using S
where V = 4
group by B
Key condition: unknown
MinMax index condition: unknown
Selected 5 parts by date, 5 parts by key, 15 marks by primary key, 15 marks to read from 5 ranges
Processed 100.00 thousand rows
select count(), B from foo_merge join
(select materialize('') as S, 5 B) x using S
where V = 4 and A = 4
group by B
Key condition: unknown
MinMax index condition: unknown
Selected 5 parts by date, 5 parts by key, 15 marks by primary key, 15 marks to read from 5 ranges
Processed 100.00 thousand rows
without merge
select count(), B from foo join
(select materialize('') as S, 5 B) x using S
where V = 4 and A = 4
group by B
Key condition: unknown, (column 0 in [4, 4]), and
MinMax index condition: (column 0 in [4, 4]), unknown, and
Selected 1 parts by date, 1 parts by key, 1 marks by primary key, 1 marks to read from 1 ranges
Processed 8.19 thousand rowsWA (subquery):
select count(), B from (select * from foo_merge) f join
(select materialize('') as S, 5 B) x using S
where V = 4 and A = 4
group by B
Key condition: (column 0 in [4, 4]), unknown, and
MinMax index condition: unknown, (column 0 in [4, 4]), and
Selected 1 parts by date, 1 parts by key, 1 marks by primary key, 1 marks to read from 1 ranges
Processed 8.19 thousand rows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
comp-joinsJOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...performance