]> granicus.if.org Git - postgresql/commit
Move estimate_hashagg_tablesize to selfuncs.c, and widen result to double.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Feb 2019 19:59:02 +0000 (14:59 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Feb 2019 19:59:12 +0000 (14:59 -0500)
commit0c7d53793079a1af3f070d93e3eb86a52720f6e7
treee8c4a47da2c593ba347359682f08de1334bc3eec
parentf9692a769b16f53be80f819fa5ee91e28dc7683a
Move estimate_hashagg_tablesize to selfuncs.c, and widen result to double.

It seems to make more sense for this to be in selfuncs.c, since it's
largely a statistical-estimation thing, and it's related to other
functions like estimate_hash_bucket_stats that are there.

While at it, change the result type from Size to double.  Perhaps at one
point it was impossible for the result to overflow an integer, but
I've got no confidence in that proposition anymore.  Nothing's actually
done with the result except to compare it to a work_mem-based limit,
so as long as we don't get an overflow on the way to that comparison,
things should be fine even with very large dNumGroups.

Code movement proposed by Antonin Houska, type change by me

Discussion: https://postgr.es/m/25767.1549359615@localhost
src/backend/optimizer/plan/planner.c
src/backend/utils/adt/selfuncs.c
src/include/utils/selfuncs.h