Repository navigation
Conversation
c8c21e1 to
b947724
Compare
enable_partition_distinct=1 (after)select distinct a,b from (select rand() as a , toString(number) as b from numbers(1e7)) Format Null settings
enable_partition_distinct=1
0 rows in set. Elapsed: 0.175 sec. Processed 10.00 million rows, 80.00 MB (57.00 million rows/s., 456.02 MB/s.)
select distinct a from (select rand() as a , toString(number) as b from numbers(1e7)) Format Null settings enable_partition_distinct=1
0 rows in set. Elapsed: 0.096 sec. Processed 10.00 million rows, 80.00 MB (104.57 million rows/s., 836.53 MB/s.)enable_partition_distinct=0select distinct a,b from (select rand() as a , toString(number) as b from numbers(1e7)) Format Null settings
enable_partition_distinct=0
0 rows in set. Elapsed: 5.012 sec. Processed 10.00 million rows, 80.00 MB (2.00 million rows/s., 15.96 MB/s.)
select a from (select rand() as a , toString(number) as b from numbers(1e7)) group by a Format Null settings enable_partition_distinct=0
0 rows in set. Elapsed: 1.026 sec. Processed 10.00 million rows, 80.00 MB (9.75 million rows/s., 77.97 MB/s.)
use a group byselect a,b from (select rand() as a , toString(number) as b from numbers(1e7)) group by a, b Format Null
0 rows in set. Elapsed: 3.094 sec. Processed 10.00 million rows, 80.00 MB (3.23 million rows/s., 25.86 MB/s.)
select a from (select rand() as a , toString(number) as b from numbers(1e7)) group by a Format Null
0 rows in set. Elapsed: 0.700 sec. Processed 10.00 million rows, 80.00 MB (14.28 million rows/s., 114.25 MB/s.) |
| for (size_t i = 0; i < output_streams; ++i) | ||
| { | ||
| Chunk output_chunk(columns, rows); | ||
| output_chunk.getChunkInfos().add(std::make_shared<PartitionedChunkInfo>(selectors[i], ref_count, filter)); |
There was a problem hiding this comment.
If filter is attached to chunk, does it mean that this step cannot be pushed down ORDER BY transforms, because in this case order may change?
There was a problem hiding this comment.
Hi, @UnamedRus can you explain more about this case ? I don't quite understand the situation being described.
There was a problem hiding this comment.
If it's scattered without copying data, I think the order should be kept in a block
There was a problem hiding this comment.
There was a problem hiding this comment.
BTW, may be you can consider using two-level hashtables (as this feature cater to DISTINCT with many keys) they can have much nicer rescaling properties (as individual bucket can be scaled up, instead of whole table).
There was a problem hiding this comment.
BTW, may be you can consider using two-level hashtables (as this feature cater to DISTINCT with many keys) they can have much nicer rescaling properties (as individual bucket can be scaled up, instead of whole table).
Yes, it should be better to support two-level hash table.
|
Workflow [PR], commit [f4d2754] Summary: ❌
|
|
Dear @Algunenano, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
Thank you for the contribution! The same approach (hash-partitioning the rows by the |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Partition the data and process each partition in parallel to perform the distinct operation. when the distinct columns have high cardinality, this approach is faster than the current implementation and a group by.
Documentation entry for user-facing changes