postgresql/src/backend/optimizer/util
Tom Lane b154ee63bb Get rid of artificial restriction on hash table sizes on Windows.
The point of introducing the hash_mem_multiplier GUC was to let users
reproduce the old behavior of hash aggregation, i.e. that it could use
more than work_mem at need.  However, the implementation failed to get
the job done on Win64, where work_mem is clamped to 2GB to protect
various places that calculate memory sizes using "long int".  As
written, the same clamp was applied to hash_mem.  This resulted in
severe performance regressions for queries requiring a bit more than
2GB for hash aggregation, as they now spill to disk and there's no
way to stop that.

Getting rid of the work_mem restriction seems like a good idea, but
it's a big job and could not conceivably be back-patched.  However,
there's only a fairly small number of places that are concerned with
the hash_mem value, and it turns out to be possible to remove the
restriction there without too much code churn or any ABI breaks.
So, let's do that for now to fix the regression, and leave the
larger task for another day.

This patch does introduce a bit more infrastructure that should help
with the larger task, namely pg_bitutils.h support for working with
size_t values.

Per gripe from Laurent Hasson.  Back-patch to v13 where the
behavior change came in.

Discussion: https://postgr.es/m/997817.1627074924@sss.pgh.pa.us
Discussion: https://postgr.es/m/MN2PR15MB25601E80A9B6D1BA6F592B1985E39@MN2PR15MB2560.namprd15.prod.outlook.com
2021-07-25 14:02:27 -04:00
..
appendinfo.c Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
clauses.c Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
inherit.c Fix planner's row-mark code for inheritance from a foreign table. 2021-06-02 14:38:14 -04:00
joininfo.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
orclauses.c Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
paramassign.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pathnode.c Get rid of artificial restriction on hash table sizes on Windows. 2021-07-25 14:02:27 -04:00
placeholder.c Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00
plancat.c Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
predtest.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
relnode.c Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
restrictinfo.c Add Result Cache executor node (take 2) 2021-04-02 14:10:56 +13:00
tlist.c Fix planner failure in some cases of sorting by an aggregate. 2021-04-20 11:32:02 -04:00
var.c Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. 2021-01-21 15:37:23 -05:00