Re: Do we perform maintenance on pg_catalog tables

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Do we perform maintenance on pg_catalog tables
Date: 2025-01-03 01:27:39
Message-ID: CANzqJaD7wvwfMJ9mi=RVAF9KwtMf5_9ksz8xdgp_rD1pTwhGfA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jan 2, 2025 at 7:18 PM Peter Gram <peter(dot)m(dot)gram(at)gmail(dot)com> wrote:

> Hi Ron
>
> How do I know if my AUTOVACUUM is Reasonably-tuned ?
>

If your queries are as fast as they can be, given proper index support. 😉

Specifically, I'd look at pg_stat_all_tables
columns relname, n_dead_tup, n_mod_since_analyze, GREATEST(last_vacuum,
last_autovacuum) and GREATEST(last_analyze, last_autoanalyze).

Run your system query a few times with EXPLAIN (BUFFERS), then "vacuumdb
--all", and then run the queries again with EXPLAIN (BUFFERS).

If they're the same speed, then your AUTOVACUUM settings are either Good
Enough, or you got lucky and the tables were recently analyzed. If they're
faster, then you need to reduce the AUTOVACUUM config variables.

These are *my* settings for *our* workload. YMMV.
autovacuum = on
autovacuum_max_workers = 4
autovacuum_vacuum_scale_factor = 0.015
autovacuum_vacuum_threshold = 50
autovacuum_vacuum_cost_delay = 4ms
autovacuum_vacuum_cost_limit = 1000
autovacuum_analyze_scale_factor = 0.015
autovacuum_analyze_threshold = 50

> Med venlig hilsen
>
> Peter Gram
> Sæbyholmsvej 18
> 2500 Valby
>
> Mobile: (+45) 5374 7107
> Email: peter(dot)m(dot)gram(at)gmail(dot)com
>
>
>
> On Fri, 3 Jan 2025 at 06.45, Ron Johnson <ronljohnsonjr(at)gmail(dot)com> wrote:
>
>> On Thu, Jan 2, 2025 at 2:50 PM srijith s <udbdoctor(at)gmail(dot)com> wrote:
>>
>>>
>>> Hello PostgreSQL Experts,
>>>
>>> Do we perform postgres maintenance (vacuum/analyze/reindex) on
>>> pg_catalog tables?
>>>
>>
>> Reasonably-tuned AUTOVACUUM config parameters should handle that for you.
>>
>
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message srijith s 2025-01-03 01:57:24 Re: Do we perform maintenance on pg_catalog tables
Previous Message Siddhartha Jain 2025-01-03 00:51:34 Upgrade for primary standby config