| From: | Shuntian Jiao <jiaoshuntian(at)gmail(dot)com> |
|---|---|
| To: | Michael Banck <mbanck(at)gmx(dot)net> |
| Cc: | Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: reltuples kept decreasing with each autovacuum run Re: BUG #18773 |
| Date: | 2026-12-04 11:19:07 |
| Message-ID: | CAJRV7SMLfosdFhuPC=MRhBwpYKPZASFot-BY4-ZKv==oKD+QOg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-hackers |
Hi Michael,
I also tested 7c91a0364fcf and its parent. Both scanned the same 91 of
222 pages, with 20,000 recently dead tuples on those pages. After
eight partial VACUUMs, the parent's estimate went from 50,000 to
49,756, while 7c91a0364fcf went from 30,000 to 1,388. The table had
30,000 live rows throughout.
Separately, I ran two tests with your patch on master(76ac7f718d86).
1. Repeated VACUUMs with no further writes. A full scan counted 44,889
live rows. I kept a transaction open and ran five ordinary VACUUMs.
Each scanned 46 of 222 pages and found 5,113 live tuples. Neither
threshold triggered, so patched and unpatched master gave the same
estimates:
44889 -> 40701 -> 37380 -> 34748 -> 32661 -> 31006
count(*) stayed at 44,889. Each drop was modest, but after five runs
the estimate was 31% low.
2. Deletes before versus after the last full scan. I arranged for two
tables to start the partial VACUUMs with the same reltuples of 30,000.
On A, the full scan had already accounted for 10,000 deletes. On B,
10,000 deletes committed just after the full scan. Each partial VACUUM
scanned 60 of 192 pages and found 168 live tuples on either table, so
the 2% rule kept both estimates at 30,000 for all five runs. That was
correct for A, but B had only 20,000 live rows. Unpatched master
dropped both estimates to 5,062.
Thanks,
Jiao Shuntian
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-12-04 12:40:45 | Re: BUG #19851: Adding a tautological CHECK(true) to a domain changes JSON_VALUE's result (silent NULL, value/type c |
| Previous Message | Nazir Bilal Yavuz | 2026-12-04 11:06:42 | Re: BUG #19953: pg_stat_io exposes impossible rows for io worker backends |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-12-04 11:39:26 | Re: Streamed transactions lose replication origin when first change is not a row change |
| Previous Message | Fujii Masao | 2026-12-04 11:15:27 | Re: Assertion failure in WAL summarizer |