On production I have database of size 150 GB. Many rows are deleted from this table and Vacuum is applied on this. Now I need to release unused space from DB to disk for OS. So Vacuum Full needs to be applied. Streaming replication is configured on production server with three secondary nodes. What is best way ?
- Pause replication and run Vacuum FULL on master node. And then Start replication again.
- Stop replication and and recreate after Vacuum FULL on master node.
You need to do nothing of the above.
VACUUM (FULL)
is replicated just like any other data modification.On the standby servers the same restriction applies as on the primary server: while
VACUUM (FULL)
is running, the affected tables are locked to any concurrent access.Since
VACUUM (FULL)
rewrites the table, it will generate a lot of WAL, so of course replication performance may be affected. But stopping replication will only delay, not reduce that, and rebuilding the standby will generate even more traffic.