8
Standby Usage
Allowed
read-only queries (SELECT, COPY TO, cursors)
setting server parameters (SET, RESET)
transaction management (BEGIN, COMMIT, ROLLBACK...)
creating a backup (pg_basebackup)
Not allowed
any changes (INSERT, UPDATE, DELETE, TRUNCATE, nextval...)
locks expecting changes (SELECT FOR UPDATE...)
DDL commands (CREATE, DROP...), including creating temporary tables
maintenance commands (VACUUM, ANALYZE, REINDEX...)
access control (GRANT, REVOKE...)
triggers and advisory locks do not work
By default, the standby operates in the hot standby mode. In this mode,
client connections are allowed but restricted to read-only operations. Setting
server parameters and transaction management commands will also work.
For example, you can start a (read-only) transaction with a specific isolation
level.
In addition, the standby can also be used for making backups (taking into
account the possible lag behind the primary).
In hot standby mode, no data changes (including sequences), locks, DDL
commands, commands such as VACUUM, ANALYZE and REINDEX or
access control commands are allowed on the standby. Basically, anything
that changes the data in any way is not accepted.
If required, the standby can be run in warm standby mode by setting the
parameter hot_standby = off. In this case, client connections will be
completely disabled.