Thread: Analyze on slave promoted.

Analyze on slave promoted.

From
Joao Junior
Date:
Hi,
Is this necessary to run analyze on a slave using streaming replication  after promotion??

Re: Analyze on slave promoted.

From
Pavel Stehule
Date:
Hi

čt 26. 9. 2019 v 9:55 odesílatel Joao Junior <jcoj2006@gmail.com> napsal:
Hi,
Is this necessary to run analyze on a slave using streaming replication  after promotion??

No - column statistics are come from master - and are persistent - promote change nothing.

Pavel

Re: Analyze on slave promoted.

From
Vik Fearing
Date:
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.