| inserting |
accepts the value of underlying type OR
a value of corresponding SimpleAggregateFunction type
CREATE TABLE saf_test ( x SimpleAggregateFunction(max, UInt64) ) ENGINE=AggregatingMergeTree ORDER BY tuple();
INSERT INTO saf_test VALUES (1); INSERT INTO saf_test SELECT max(number) FROM numbers(10); INSERT INTO saf_test SELECT maxSimpleState(number) FROM numbers(20);
|
ONLY accepts the state of same aggregate function calculated using -State
combinator |
| storing |
Internally store just a value of underlying type |
function-specific state |
| storage usage |
typically is much better due to better compression/codecs |
in very rare cases it can be more optimal than raw values
adaptive granularity doesn't work for large states
|
| reading raw value per row |
you can access it directly |
you need to use finalizeAggregation function |
| using aggregated value |
just
select max(x) from test;
|
you need to use -Merge combinator
select maxMerge(x) from test;
|
| memory usage |
typically less memory needed (in some corner cases even 10 times) |
typically uses more memory, as every state can be quite complex |
| performance |
typically better, due to lower overhead |
worse |