Score:1

Do AWS replicas of Postgres RDS instances require Vacuum and Analyze independently of their primary?

ss flag

Assuming that I am not using logical replication...

I'm not clear on how the low level replication interacts with other low level operations like vacuum and analyze.

I'm not clear on whether replicas tend towards being block level copies of their primary server, with changes made by vacuum on the primary being replicated on the replica. Or if replicas are more responsible for self maintenance.


Background

We have an RDS instance that is growing around 2 TB per year. Today we noticed some of our existing queries are running very slow.

With a sudden change happening to a query on a very large table that grows really consistently, my first instinct is to check for code changes and my second is to check table stats.

But this has pointed to a gap in my knowledge when it comes to vacuum / analyze.

Score:2
us flag

Amazon RDS for PostgreSQL uses PostgreSQL's built-in streaming replication.

In essence, it is a server-wide, low-level replication, also sometimes referred to as physical replication. Yes, you may think of it as some kind of block-level replication.

But streaming replication does not really replicate blocks. It works by continuously sending WAL data (redo records) from the primary to be replayed onto replicas.

A vacuum operation gets recorded in WAL, and it is replayed onto replica servers.

As for an analyze operation, the resulting statistics are written to the system tables pg_class and pg_statistic. The updates of these tables get recorded in WAL and are replayed onto replicas.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.