Logical replication allows data to be copied between PostgreSQL servers. What is its main use?
Think about what logical replication copies: is it the whole database or parts of it?
Logical replication copies data changes at the table level, allowing selective replication of specific tables. It does not replicate the entire cluster or configuration files.
Given a publication created with CREATE PUBLICATION pub1 FOR TABLE employees;, which rows will be replicated to the subscriber?
CREATE PUBLICATION pub1 FOR TABLE employees;
Think about whether logical replication copies existing data or just changes.
Logical replication replicates data changes (inserts, updates, deletes) that happen after the publication is created. It does not automatically copy existing rows.
Choose the correct SQL command to create a subscription named sub1 connecting to a publisher at host=192.168.1.10 dbname=company for publication pub1.
Check the exact syntax for the CREATE SUBSCRIPTION command in PostgreSQL.
The correct syntax uses CONNECTION followed by the connection string and PUBLICATION followed by the publication name without extra keywords.
You notice replication lag between publisher and subscriber. Which approach helps reduce lag?
Consider how commit settings affect replication speed and confirmation.
Setting synchronous_commit to remote_apply ensures transactions wait until changes are applied on the subscriber, reducing lag but possibly increasing transaction latency.
A subscription fails to start with the error: ERROR: could not find replication origin. What is the most likely cause?
Think about what replication origin means and what happens if it is missing.
The error usually means the replication slot or origin on the subscriber side is missing or corrupted, causing the subscription to fail.