Can GROUP BY still be optimized after all these years?

pivotlake.io

96 points by ntur1337 4 days ago


SkiFire13 - 3 hours ago

I wonder why you didn't opt to perform a Top-K aggregation in each partition in parallel. That would give you both a reduction of elements in each partition and also the correct maximum of each partition, which can be used for further pruning.

ozgrakkurt - 9 hours ago

Their clickbench results look really good.

https://benchmark.clickhouse.com/#system=+liH|Hoaus|DcD|ucqs...

malisper - 8 hours ago

Neat! For others, the data structure they are describing is a count-min sketch. It looks like they're using it to set a bound on elements that can enter the group-by and using it to skip a bunch of extra work

holoduke - 5 hours ago

I wonder if with a LLM you could better analyse and make a strategy for querying. Maybe even live restructuring of data models based on its usage.

misiek08 - 6 hours ago

22.2ms vs 35.6ms is 1.6x faster! It's 0.4x faster and even doing worst math possible it's 0.62x faster.

Can't we really keep the IT without breaking news/we are all gonna die/sensationalist way of passing news?

shikck200 - 8 hours ago

More importantly, WHY is mysql GROUP BY still broken as default? MySQL is the PHP of databases, but it seems they have no plan to fix bugs.

toddbandrowsky - 11 hours ago

You know, I have a hard time seeing how it can be cheaper to run a dataset across a wire rather than just send its grouped results. That's really the problem. I mean, who cares if it takes 100ns to group by on a box when it will take 10 times much for the data to get to it and back.

The fastest possible group by is in sequential memory on that box, fetched from an nvme.

So, when we do group by partitioning, we're really saying, put the groups themselves on different boxes, and group the group by. If it were some utter megaset, the place to put it is on a mainframe, which is basically created for purposes of group by on ridiculous datasets.

hujun236 - 11 hours ago

[dead]