| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | Vaibhav Jain <jainva(at)google(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, pg(at)bowt(dot)ie, andres(at)anarazel(dot)de, rmt(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [BUG / PATCH] PG19: VACUUM misestimates reltuples (often 0) after on-access VM setting |
| Date: | 2026-11-12 22:13:08 |
| Message-ID: | CAAKRu_Zh8mUy0URWPWaH9QeFO2PP_kZS64qh7QDOM97+AkqaOA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Nov 11, 2026 at 6:51 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> On Wed, Oct 21, 2026 at 2:37 AM Vaibhav Jain <jainva(at)google(dot)com> wrote:
> >
> > In PostgreSQL 19 (reproduced on REL_19_STABLE at 48b43081e55 and master),
> > VACUUM can misestimate pg_class.reltuples -- often setting reltuples = 0
> > and resetting pg_stat_all_tables.n_live_tup to 0 on a newly populated table --
> > if a read-only query runs between loading the table and the first VACUUM. It
> > can also corrupt an existing reltuples estimate that was just computed by
> > ANALYZE.
...
> I think 2-4 can be done in a preliminary commit and 1 in its own commit.
I've pushed several preliminary commits to 19 and master and left only
the commit excluding new pages from the estimate used to extrapolate
reltuples. That is the one that changes the API for
vac_estimate_reltuples(). I'm going to check with RMT (copied here)
before pushing that but because code freeze for 19 GA isn't until
Saturday, I think we could possibly push this as a change to
vac_estimate_reltuples instead of adding a wrapper function and
leaving the existing API.
RMT, are you okay with me pushing a function signature change (adding
a parameter) to vac_estimate_reltuples() in a commit tomorrow before
the 19.0 freeze?
- Melanie
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Exclude-new-pages-from-VACUUM-reltuples-estimates.patch | text/x-patch | 13.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert I Nilsson | 2026-11-12 22:22:33 | Re: [PATCH] Fix SASLprep validation after NFKC normalization |
| Previous Message | Matheus Alcantara | 2026-11-12 21:46:47 | Re: hashjoins vs. Bloom filters (yet again) |