Repository navigation
Select final - #15938
Select final#15938
Conversation
There is a possibility that partition was attached from ./detached dir or from another table and already has level > 0 and duplicates, so it isn't a reliable way to check this, or we would need to reset the level of that partition to zero in that kind of parts manipulation. |
|
Maybe better to have simple rule: if one part in partition - do not postprocess it. |
CurtizJ
left a comment
There was a problem hiding this comment.
It will be useful to add a perf test and also to check the difference in performance with case, when all partitions are merged.
@CurtizJ I've never written perf tests before, can you explain what should I do in performance test? Just make a query with |
|
You can find examples of performance tests in tests/performance. Test is a .xml file with bunch of queries for measuring time of their executing and possible some additional queries for preparation. Also you can set specific settings for tests. A good example, where all sections exist. It's recommended for execution time of query to be in 0.1-1s. Yes, just add a query with
It's ok to compare two modes of |
Thanks for clear explanation! I will try to do it at this week |
|
@CurtizJ I see this exception in my perf test: |
|
@Avogar It because performance test runs two servers: old and new. |
|
|
|
hm, I don't see much improvement: 3.611s VS 2.063s. CREATE TABLE T (p Int64, d Date, some_col String)
Engine=ReplacingMergeTree
Partition by toYYYYMM(d)
Order by (p, d);
insert into T select number, '2020-01-01', '' from numbers(100000000);
insert into T select number, '2020-01-01', 'updated' from numbers(100000000);
optimize table T final;
select distinct(_part) from T;
┌─_part──────────┐
│ 202001_1_192_4 │
└────────────────┘
select max(d) from T final where some_col = 'updated';
Elapsed: 3.611 sec. Processed 100.00 million rows, 2.60 GB (27.69 million rows/s., 720.04 MB/s.)
select max(d) from T final where some_col = 'updated' SETTINGS do_not_merge_across_partitions_select_final = 1;
Elapsed: 2.063 sec. Processed 100.00 million rows, 2.60 GB (48.47 million rows/s., 1.26 GB/s.)
expected:
select max(d) from T where some_col = 'updated';
Elapsed: 0.202 sec. Processed 100.00 million rows, 1.80 GB (494.28 million rows/s., 8.90 GB/s.)
|
Yes, you're right. I forgot to add parallel select in this case. I added it here #19375 |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Do not merge parts across partitions in SELECT FINAL
Detailed description / Documentation draft:
Define a new setting
do_not_merge_across_partitions_select_final. If it's true we will merge parts only with the same partition, moreover, if there is only one part in partition and it's level > 0 we won't merge it. This resolves #11722