3 ms·
No one implemented a better solution ;-) Jokes aside, it seems simple but is fairly tricky, as it depends both on input data and various other parameters. For
by pgaddict 10y ago
No one implemented a better solution ;-)
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.