大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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 lev…

问题原文

原帖链接 · Philip Couling · CC BY-SA 4.0

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.

已采纳解答

原帖链接 · rblst · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-12-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。