postgresql/src/backend
Tom Lane 2debceed29 YA attempt at taming worst-case behavior of get_actual_variable_range.
We've made multiple attempts at preventing get_actual_variable_range
from taking an unreasonable amount of time (3ca930fc3, fccebe421).
But there's still an issue for the very first planning attempt after
deletion of a large number of extremal-valued tuples.  While that
planning attempt will set "killed" bits on the tuples it visits and
thereby reduce effort for next time, there's still a lot of work it
has to do to visit the heap and then set those bits.  It's (usually?)
not worth it to do that much work at plan time to have a slightly
better estimate, especially in a context like this where the table
contents are known to be mutating rapidly.

Therefore, let's bound the amount of work to be done by giving up
after we've visited 100 heap pages.  Giving up just means we'll
fall back on the extremal value recorded in pg_statistic, so it
shouldn't mean that planner estimates suddenly become worthless.

Note that this means we'll still gradually whittle down the problem
by setting a few more index "killed" bits in each planning attempt;
so eventually we'll reach a good state (barring further deletions),
even in the absence of VACUUM.

Simon Riggs, per a complaint from Jakub Wartak (with cosmetic
adjustments by me).  Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAKZiRmznOwi0oaV=4PHOCM4ygcH4MgSvt8=5cu_vNCfc8FSUug@mail.gmail.com
2022-11-22 14:40:44 -05:00
..
access Fix cleanup lock acquisition in SPLIT_ALLOCATE_PAGE replay. 2022-11-14 10:32:47 +05:30
backup Message style improvements 2022-09-24 18:38:35 -04:00
bootstrap Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
catalog Avoid crash after function syntax error in a replication worker. 2022-11-03 12:01:57 -04:00
commands Fix CREATE DATABASE so we can pg_upgrade DBs with OIDs above 2^31. 2022-11-04 10:39:52 -04:00
executor Fix MERGE tuple count with DO NOTHING 2022-11-17 18:56:11 +01:00
foreign Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:40 +09:00
jit Track LLVM 15 changes. 2022-10-19 22:18:54 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 16:01:22 +12:00
libpq Remove misguided SSL key file ownership check in libpq. 2022-05-26 14:14:05 -04:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:32 +09:00
nodes Fix pg_stat_statements for MERGE 2022-09-27 10:44:42 +02:00
optimizer Update some comments that should've covered MERGE 2022-10-24 12:52:43 +02:00
parser Fix CREATE DATABASE so we can pg_upgrade DBs with OIDs above 2^31. 2022-11-04 10:39:52 -04:00
partitioning Small cleanup of create_list_bounds() 2022-07-13 17:01:39 +12:00
po Translation updates 2022-11-07 19:22:54 +01:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Rework shutdown callback of archiver modules 2022-10-19 14:07:01 +09:00
regex Defend against stack overrun in a few more places. 2022-08-24 13:02:19 -04:00
replication Ignore invalidated slots while computing oldest catalog Xmin 2022-11-22 10:56:07 +01:00
rewrite Reject non-ON-SELECT rules that are named "_RETURN". 2022-10-17 12:14:39 -04:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Partially undo commit 94da73281. 2022-08-05 15:57:46 -04:00
storage Ignore invalidated slots while computing oldest catalog Xmin 2022-11-22 10:56:07 +01:00
tcop Force immediate commit after CREATE DATABASE etc in extended protocol. 2022-07-26 13:07:03 -04:00
tsearch Add comments and a missing CHECK_FOR_INTERRUPTS in ts_headline. 2022-11-21 17:07:07 -05:00
utils YA attempt at taming worst-case behavior of get_actual_variable_range. 2022-11-22 14:40:44 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Move basebackup code to new directory src/backend/backup 2022-08-10 14:03:09 -04:00
nls.mk Translation updates 2022-11-07 14:04:05 +01:00