summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2025-02-19 23:51:48 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2025-02-19 23:54:18 +0100
commit587b6aa3f3cea5d30e65317c34d0cae288edaa6d (patch)
treeef40b8f8a0032266df02b355677c70d371020903 /src/backend/utils/adt/ruleutils.c
parent788baa9a25ae83b576621166367c868d3329b4d4 (diff)
Correct relation size estimate with low fillfactor
Since commit 29cf61ade3, table_block_relation_estimate_size() considers fillfactor when estimating number of rows in a relation before the first ANALYZE. The formula however did not consider tuples may be larger than available space determined by fillfactor, ending with density 0. This ultimately means the relation was estimated to contain a single row. The executor however places at least one tuple per page, even with very low fillfactor values, so the density should be at least 1. Fixed by clamping the density estimate using clamp_row_est(). Reported by Heikki Linnakangas. Fix by me, with regression test inspired by example provided by Heikki. Backpatch to 17, where the issue was introduced. Reported-by: Heikki Linnakangas Backpatch-through: 17 Discussion: https://postgr.es/m/2bf9d973-7789-4937-a7ca-0af9fb49c71e@iki.fi
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
0 files changed, 0 insertions, 0 deletions