postgresql/src/include/executor
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
..
execAsync.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
execdebug.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
execdesc.h Revert "Don't lock partitions pruned by initial pruning" 2025-05-22 17:02:35 +09:00
execExpr.h Add special case fast-paths for strict functions 2025-03-11 12:02:42 +01:00
execParallel.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
execPartition.h Ensure first ModifyTable rel initialized if all are pruned 2025-03-19 12:14:24 +09:00
execScan.h Fix EvalPlanQual handling of foreign/custom joins in ExecScanFetch. 2025-10-15 17:15:00 +09:00
executor.h Change "long" numGroups fields to be Cardinality (i.e., double). 2025-11-02 16:57:43 -05:00
functions.h Change SQL-language functions to use the plan cache. 2025-04-02 14:06:02 -04:00
hashjoin.h Get rid of our dependency on type "long" for memory size calculations. 2025-01-31 13:52:40 -05:00
instrument.h Add wal_fpi_bytes to pg_stat_wal and pg_stat_get_backend_wal() 2025-10-28 16:21:51 +09:00
nodeAgg.h Sync typedefs.list with the buildfarm. 2025-06-15 13:04:24 -04:00
nodeAppend.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeBitmapAnd.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeBitmapHeapscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeBitmapIndexscan.h Show index search count in EXPLAIN ANALYZE, take 2. 2025-03-11 09:20:50 -04:00
nodeBitmapOr.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeCtescan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeCustom.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeForeignscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeFunctionscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeGather.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeGatherMerge.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeGroup.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeHash.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeHashjoin.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeIncrementalSort.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeIndexonlyscan.h Show index search count in EXPLAIN ANALYZE, take 2. 2025-03-11 09:20:50 -04:00
nodeIndexscan.h Show index search count in EXPLAIN ANALYZE, take 2. 2025-03-11 09:20:50 -04:00
nodeLimit.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeLockRows.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeMaterial.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeMemoize.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeMergeAppend.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeMergejoin.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeModifyTable.h Virtual generated columns 2025-02-07 09:46:59 +01:00
nodeNamedtuplestorescan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeNestloop.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeProjectSet.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeRecursiveunion.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeResult.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeSamplescan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeSeqscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeSetOp.h Improve planner's estimates of tuple hash table sizes. 2025-11-02 16:57:26 -05:00
nodeSort.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeSubplan.h Improve planner's estimates of tuple hash table sizes. 2025-11-02 16:57:26 -05:00
nodeSubqueryscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeTableFuncscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeTidrangescan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeTidscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeUnique.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeValuesscan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeWindowAgg.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
nodeWorktablescan.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
spi.h Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
spi_priv.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
tablefunc.h Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
tqueue.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
tstoreReceiver.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
tuptable.h Don't include access/htup_details.h in executor/tuptable.h 2025-10-05 18:00:38 +02:00