1

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.

Philip Couling
  • 1,682
  • 1
  • 19
  • 37

1 Answers1

2

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.

rblst
  • 46
  • 2