Re: When manual analyze is needed

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: veem v <veema0000(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: When manual analyze is needed
Date: 2024-03-04 04:12:09
Message-ID: b7aeea8a2f84a11b330137bf8849a0fc1e88ffee.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2024-03-04 at 01:33 +0530, veem v wrote:
> We see in one of the RDS postgres instances, from pg_stat_user_tables ,
> the auto vacuum and auto analyze happening on the tables without our
> manual intervention.

That's exactly the idea behind autovacuum.

> So is auto vacuum analyze is sufficient  to make sure optimal stats
> and unbloated table structure in place

Yes, it is sufficient. If you have a busy database, you may have to
tune autovacuum to keep up.

The only things that require manual ANALYZE are

1. partitioned tables (autoanalyze will collect statistics on the
partitions, but not the partitioned table itself)

2. after you create an index on an expression (otherwise you have to
wait until autoanalyze runs to get statistics on the indexed
expression)

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2024-03-04 04:14:23 Re: Guarantees/Semantics of pg_stats
Previous Message Laurenz Albe 2024-03-04 04:07:34 Re: Orphan files filling root partition after crash