by life_is_short · 10y ago · 0 comments
Can you say a bit more why?
Jokes aside, it seems simple but is fairly tricky, as it depends both on input data and various other parameters. For example for array_agg() or string_agg() it might be estimated from number of entries / average length. For hll it also depends on the accuracy and expected number of values to track, etc. I was considering adding another method to the API, providing a better estimate, but never got to that.
So the current code simply assumes 1KB (IIRC) per group in those cases, or something like that.
Of course, the memory estimate also depends on the number of groups, but that's an orthogonal issue.