RE: vacuum analyze query performance - help me understand

From: Scot Kreienkamp <Scot(dot)Kreienkamp(at)la-z-boy(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-generallists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: vacuum analyze query performance - help me understand
Date: 2025-08-19 20:09:40
Message-ID: SJ0PR15MB5245E8979235B81FD116039B9A30A@SJ0PR15MB5245.namprd15.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

If the plan didn't change then the stats updates weren't very relevant.
I am guessing that the actual problem was that those tables were
full of dirty rows, and the VACUUM (not the ANALYZE part) got rid
of dead rows, set hint bits on recently-updated rows, and generally
did a lot of janitorial work that makes subsequent table scans faster.

[Scot Kreienkamp]
I thought dead rows were excluded from backup and the resulting restore? All the janitorial was already done a few hours before by a vacuum analyze, so with no activity there shouldn't have been any to do. That's why I'm still looking for answers.

Turning off autovacuum is an anti-pattern.

[Scot Kreienkamp]
Agreed, that's why it's not disabled. I'm out of date, not clueless. The only time I turn off autovac is during full database restores. Last I knew running a periodic reindex and a daily vac/analyze even with autovac enabled was considered best practice. Is that no longer the case?

(Running a PG version that's four years past EOL is also an
anti-pattern, but you knew that. Should I ask whether it's
at least the final 9.6 minor release?)

[Scot Kreienkamp]
It is the final release. I guarantee I'm more irritated that we're still on this version than anyone else on earth. They've been warned, many times and loudly, for much longer than 4 years. All I can do is keep reminding and warning of the consequences, like not being able to get help with problems when they inevitably arise. In the meantime, I still have to support it like a number of people's livelihoods (including mine) depends on it. Because they do.

Scot Kreienkamp | Applications Infrastructure Architect | La-Z-Boy Corporate
One La-Z-Boy Drive | Monroe, Michigan 48162 | • (734) 384-6403 | | • 1-734-915-1444 | Email: Scot(dot)Kreienkamp(at)la-z-boy(dot)com

This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you.

Attachment Content-Type Size
winmail.dat application/ms-tnef 22.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scot Kreienkamp 2025-08-19 20:25:26 RE: Streaming replica hangs periodically for ~ 1 second - how to diagnose/debug
Previous Message Adrian Klaver 2025-08-19 18:39:03 Re: Streaming replica hangs periodically for ~ 1 second - how to diagnose/debug