pgsql: Remove bogus "safety margin" from predicate.c shmem estimates

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove bogus "safety margin" from predicate.c shmem estimates
Date: 2026-04-03 17:32:04
Message-ID: E1w8iNH-002maQ-0y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove bogus "safety margin" from predicate.c shmem estimates

The 10% safety margin was copy-pasted from lock.c when the predicate
locking code was originally added. However, we later (commit
7c797e7194) added the HASH_FIXED_SIZE flag to the hash tables, which
means that they cannot actually use the safety margin that we're
calculating for them.

The extra memory was mainly used by the main lock manager, which is
the only shmem hash table of non-trivial size that does not use the
HASH_FIXED_SIZE flag. If we wanted to have more space for the lock
manager, we should reserve it directly in lock.c. After this commit,
the lock manager will just have less memory available than before.

Reviewed-by: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/e07be2ba-856b-4ff5-8313-8b58b6b4e4d0@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/feb03dfecdc9810619bc94793be3257a487a669f

Modified Files
--------------
src/backend/storage/lmgr/predicate.c | 6 ------
1 file changed, 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-04-03 19:03:38 pgsql: Refactor relation_needs_vacanalyze().
Previous Message Amit Langote 2026-04-03 06:44:24 Re: pgsql: Optimize fast-path FK checks with batched index probes