postgresql/src/backend
Tom Lane 8f29467c57 Change "long" numGroups fields to be Cardinality (i.e., double).
We've been nibbling away at removing uses of "long" for a long time,
since its width is platform-dependent.  Here's one more: change the
remaining "long" fields in Plan nodes to Cardinality, since the three
surviving examples all represent group-count estimates.  The upstream
planner code was converted to Cardinality some time ago; for example
the corresponding fields in Path nodes are type Cardinality, as are
the arguments of the make_foo_path functions.  Downstream in the
executor, it turns out that these all feed to the table-size argument
of BuildTupleHashTable.  Change that to "double" as well, and fix it
so that it safely clamps out-of-range values to the uint32 limit of
simplehash.h, as was not being done before.

Essentially, this is removing all the artificial datatype-dependent
limitations on these values from upstream processing, and applying
just one clamp at the moment where we're forced to do so by the
datatype choices of simplehash.h.

Also, remove BuildTupleHashTable's misguided attempt to enforce
work_mem/hash_mem_limit.  It doesn't have enough information
(particularly not the expected tuple width) to do that accurately,
and it has no real business second-guessing the caller's choice.
For all these plan types, it's really the planner's responsibility
to not choose a hashed implementation if the hashtable is expected
to exceed hash_mem_limit.  The previous patch improved the
accuracy of those estimates, and even if BuildTupleHashTable had
more information it should arrive at the same conclusions.

Reported-by: Jeff Janes <jeff.janes@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAMkU=1zia0JfW_QR8L5xA2vpa0oqVuiapm78h=WpNsHH13_9uw@mail.gmail.com
2025-11-02 16:57:43 -05:00
..
access Document nbtree row comparison design. 2025-11-02 15:27:05 -05:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Don't include access/htup_details.h in executor/tuptable.h 2025-10-05 18:00:38 +02:00
bootstrap Add new OID alias type regdatabase. 2025-06-30 15:38:54 -05:00
catalog Mark ItemPointer arguments as const throughout 2025-10-30 14:12:06 +01:00
commands Expose wal_fpi_bytes in EXPLAIN (WAL) 2025-10-30 15:34:01 +09:00
executor Change "long" numGroups fields to be Cardinality (i.e., double). 2025-11-02 16:57:43 -05:00
foreign Track the number of presorted outer pathkeys in MergePath 2025-05-08 18:21:32 +09:00
jit Fix incorrect zero extension of Datum in JIT tuple deform code 2025-10-23 13:11:02 +13:00
lib Replace defunct URL with stable archive.org URL in rbtree.c 2025-10-17 09:38:49 +02:00
libpq Remove hbaPort type 2025-09-15 11:04:10 +02:00
main Force LC_COLLATE to C in postmaster. 2025-07-16 14:13:18 -07:00
nodes Fix some confusing uses of const 2025-10-30 11:20:04 +01:00
optimizer Change "long" numGroups fields to be Cardinality (i.e., double). 2025-11-02 16:57:43 -05:00
parser Use C11 char16_t and char32_t for Unicode code points. 2025-10-29 14:17:13 -07:00
partitioning Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
po Translation updates 2025-05-05 12:04:49 +02:00
port Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
postmaster Avoid assuming that time_t can fit in an int. 2025-10-22 17:50:11 -04:00
regex Add pg_iswalpha() and related functions. 2025-10-15 12:54:01 -07:00
replication Fix regression with slot invalidation checks 2025-10-30 13:13:28 +09:00
rewrite Don't generate fake "*TLOCRN*" or "*TROCRN*" aliases, either. 2025-09-08 12:58:07 -04:00
snowball Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
statistics Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
storage Mark ItemPointer arguments as const throughout 2025-10-30 14:12:06 +01:00
tcop Simplify coding in ProcessQuery 2025-10-30 11:26:35 +01:00
tsearch Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
utils Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
.gitignore
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
meson.build meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
nls.mk Create a separate file listing backend types 2025-09-26 15:21:49 +02:00