Re: Analyze on slave promoted.

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: Joao Junior <jcoj2006(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: Analyze on slave promoted.
Date: 2019-09-27 10:41:05
Message-ID: ba1c2d91-d1af-f704-7374-5f2ec771db38@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 26/09/2019 09:54, Joao Junior wrote:
> Hi,
> Is this necessary to run analyze on a slave using streaming
> replication  after promotion??
>

Yes, you should run ANALYZE on all of your tables in all of your
databases after a promotion.  The data distribution statistics are
replicated, as Pavel mentioned, but other statistics are not.  In
particular, pg_stat_all_tables.n_dead_tup is not replicated and so
autovacuum has no idea when it needs to run.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Olivier Gautherot 2019-09-27 12:36:13 Re: Monitor Postgres database status on Docker
Previous Message Laurenz Albe 2019-09-27 05:55:06 Re: Autovacuum is cleaning very less dead tuples