postgresql/src/include/port
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
..
atomics Update copyright for 2021 2021-01-02 13:06:25 -05:00
win32
win32_msvc Add d_type to our Windows dirent emulation. 2020-09-07 23:38:19 +12:00
aix.h
atomics.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
cygwin.h Remove obsolete cygwin.h hack 2020-08-15 11:27:41 +02:00
darwin.h
freebsd.h Default to wal_sync_method=fdatasync on FreeBSD. 2021-02-15 16:04:59 +13:00
hpux.h
linux.h
netbsd.h
openbsd.h
pg_bitutils.h Get rid of artificial restriction on hash table sizes on Windows. 2021-07-25 14:02:27 -04:00
pg_bswap.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_crc32c.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_iovec.h Probe for preadv/pwritev in a more macOS-friendly way. 2021-07-12 19:17:35 -04:00
pg_pthread.h Add missing pthread_barrier_t. 2021-03-10 17:44:04 +13:00
solaris.h Remove obsolete HAVE_BUGGY_SOLARIS_STRTOD 2020-08-15 11:27:41 +02:00
win32_port.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
win32.h