DuckDB's memory model works perfectly well. I have run tests to benchmark the hash aggregation performance with different OLAP databases today, prepared a dataset with 10^9 rows and various distinct values. Within 32GB memory, DuckDB can finish the count distinct query (although it's slow). Others may tell me it runs out of memory, since all of them have the ability to spill to disk temporarily.