Back to Yugabyte Db

Monitor CDC (logical replication) in YugabyteDB

docs/content/stable/additional-features/change-data-capture/using-logical-replication/monitor.md

2026.1.0.0-b257.4 KB
Original Source

Catalog objects and views

pg_publication

Contains all publication objects contained in the database.

Column nameData typeDescription
oidoidRow identifier
pubnamenameName of the publication
pubowneroidOID of the owner.
puballtablesboolIf true, this publication includes all tables in the database including those added in the future.
pubinsertboolIf true, INSERT operations are replicated for tables in the publication.
pubupdateboolIf true, UPDATE operations are replicated for tables in the publication.
pubdeleteboolIf true, DELETE operations are replicated for tables in the publication.
pubtruncateboolIf true, TRUNCATE operations are replicated for tables in the publication.

pg_publication_rel

Contains mapping between publications and tables. This is a many-to-many mapping.

Column nameData typeDescription
oidoidRow identifier.
prpubidoidOID of the publication. References pg_publication.oid.
prrelidoidOID of the relation. References pg_class.oid.

pg_publication_tables

Contains mapping between publications and tables. It is a wrapper over pg_publication_rel as it expands the publications defined as FOR ALL TABLES, so for such publications there will be a row for each eligible table.

Column nameData typeDescription
pubnamenameName of publication.
schemanamenameName of schema containing table.
tablenamenameName of table.

pg_replication_slots

Provides a list of all replication slots that currently exist on the database cluster, along with their metadata.

Column nameData typeDescription
slot_namenameName of the replication slot.
pluginnameOutput plugin name.
slot_typetextAlways logical.
datoidoidThe OID of the database this slot is associated with.
databasetextThe name of the database this slot is associated with.
temporarybooleanTrue if this is a temporary replication slot. Temporary slots are automatically dropped on error or when the session has finished.
activebooleanTrue if this slot is currently actively being used. In YSQL, an "active" replication slot means a slot which has been consumed at least once in a certain time frame. The time is defined using the ysql_cdc_active_replication_slot_window_ms flag, which has a default of 5 minutes.
active_pidintegerThe process ID of the session using this slot if the slot is currently actively being used. NULL if no replication process is ongoing.
xminxidThe oldest transaction that this slot needs the database to retain.
catalog_xminxidNot applicable for YSQL. Always set to xmin.
restart_lsnpg_lsnThe Log Sequence Number (LSN) of the oldest change record which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints.
confirmed_flush_lsnpg_lsnThe LSN up to which the logical slot's consumer has confirmed receiving data. Data older than this is not available anymore. Transactions with commit LSN lower than the confirmed_flush_lsn are not available anymore.
yb_stream_idtextUUID of the CDC stream
yb_restart_commit_htint8A uint64 representation of the commit Hybrid Time corresponding to the restart_lsn. This can be used by the client (like YugabyteDB connector) to perform a consistent snapshot (as of the consistent_point) in the case when a replication slot already exists.

pg_stat_replication

Displays information about active WAL senders, providing insights into the state of replication for each connected standby or logical replication client.

Column nameData typeDescription
pidintegerProcess ID of WAL sender process.
usesysidoidOID of the user logged into this WAL sender process.
usenamenameName of the user logged into this WAL sender process.
application_nametextName of the application that is connected to this WAL sender.
client_addrinetIP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine.
client_hostnametextHost name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when the log_hostname configuration parameter is enabled.
client_portintegerTCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used.
backend_starttimestamp with time zoneTime when this process was started (that is, when the client connected to this WAL sender).
backend_xminxidThe oldest transaction the client is interested in.
statetextCurrent WAL sender state. Always streaming.
sent_lsnpg_lsnLast write-ahead log location sent on this connection.
write_lsnpg_lsnThe last LSN acknowledged by the logical replication client.
flush_lsnpg_lsnSame as write_lsn.
replay_lsnpg_lsnSame as write_lsn.
write_lagintervalThe difference between the timestamp of the latest record in WAL and the timestamp of the last acknowledged record. Since YugabyteDB does not differentiate between write, flush, or replay, this value is the same for all three lag metrics.
flush_lagintervalSame as write_lag.
replay_lagintervalSame as write_lag.
sync_priorityintegerSynchronous state of this standby server. Always 0, as logical replication only supports asynchronous replication.
sync_statetextSynchronous state of this standby server. Always async.
reply_timetimestamp with time zoneTimestamp of the last reply message received from the client.

CDC service metrics

Provide information about the CDC service in YugabyteDB.

Metric nameTypeDescription
cdcsdk_change_event_countlongThe number of records sent by the CDC Service.
cdcsdk_traffic_sentlongTotal traffic sent, in bytes.
cdcsdk_sent_lag_microslongThis lag metric is calculated by subtracting the timestamp of the latest record in the WAL of a tablet from the last record sent to the CDC connector.
cdcsdk_expiry_time_mslongThe time left to read records from WAL is tracked by the Stream Expiry Time (ms).
cdcsdk_flush_laglongThis lag metric shows the difference between the timestamp of the latest record in the WAL and the replication slot's restart time.

CDC service metrics are only calculated for tablets that are of interest for a replication slot. By default, tablets are considered to be of interest if they are polled at least once in 4 hours. You can configure the frequency using the cdcsdk_tablet_not_of_interest_timeout_secs YB-TServer flag. Metrics are calculated considering unpolled tablets until this timeout elapses.

Connector metrics

<!-- TODO (Siddharth): Fix link to connector metrics section -->

Refer to Monitoring for information on YugabyteDB connector metrics.