Created
October 25, 2023 21:48
-
-
Save den-crane/baa4cd9bfc78e545a3cdc359d4e48140 to your computer and use it in GitHub Desktop.
uniqHLL12 vs uniqTheta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table x (a Int64, b Int64, c Int64, | |
u AggregateFunction(uniqHLL12, String), | |
t AggregateFunction(uniqTheta, String)) | |
Engine=MergeTree order by (a,b,c); | |
insert into x select number%11111 a, number%44 b, number%3 c, uniqHLL12State(number::String), uniqThetaState(number::String) | |
from numbers(1e7) group by a,b,c; | |
optimize table x final; | |
select a, b, uniqHLL12Merge(u) from x group by a, b format Null; | |
0 rows in set. Elapsed: 0.348 sec. Processed 1.47 million rows, 258.13 MB (4.21 million rows/s., 741.63 MB/s.) | |
Peak memory usage: 1.57 GiB. | |
select a, b, uniqThetaMerge(t) from x group by a, b format Null; | |
0 rows in set. Elapsed: 0.848 sec. Processed 1.47 million rows, 58.67 MB (1.73 million rows/s., 69.17 MB/s.) | |
Peak memory usage: 645.29 MiB. | |
select uniqHLL12Merge(u) from x; | |
┌─uniqHLL12Merge(u)─┐ | |
│ 9915063 │ | |
└───────────────────┘ | |
1 row in set. Elapsed: 0.105 sec. Processed 1.47 million rows, 234.66 MB (13.95 million rows/s., 2.23 GB/s.) | |
Peak memory usage: 21.33 MiB. | |
select uniqThetaMerge(t) from x; | |
┌─uniqThetaMerge(t)─┐ | |
│ 9943597 │ | |
└───────────────────┘ | |
1 row in set. Elapsed: 0.572 sec. Processed 1.47 million rows, 35.20 MB (2.56 million rows/s., 61.53 MB/s.) | |
Peak memory usage: 177.87 MiB. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment