数据仓库服务 GaussDB(DWS)-实时数仓函数:pgxc_get_binlog_changes(rel_name text, node_id int, start_csn bigint, end_csn bigInt)

时间:2025-02-12 15:01:49

pgxc_get_binlog_changes(rel_name text, node_id int, start_csn bigint, end_csn bigInt)

描述:该函数用于获取目标表在指定DN上指定同步点区间的增量数据(node_id给0表示指定所有DN),只能对开启binlog或binlog时间戳的表使用。该函数仅9.1.0.200及以上集群版本支持。

返回值类型:record

返回值:

gs_binlog_sync_point :同步点

gs_binlog_event_sequence:用于表示同一事务内的先后顺序

gs_binlog_event_type:binlog类型

gs_binlog_timestamp_us:binlog记录的时间戳,对于enable_binlog_timestamp为false的binlog表,该列返回空

value columns:目标表上各个用户字段的数据

示例:

12345678
SELECT * FROM pgxc_get_binlog_changes('hstore_binlog_source', 0, 0 , 9999999999); gs_binlog_sync_point | gs_binlog_event_sequence | gs_binlog_event_type | gs_binlog_timestamp_us | c1  | c2 | c3----------------------+--------------------------+----------------------+------------------------+-----+----+----                10516 |                        2 | I                    |       1731570520900211 | 100 |  1 |  1                10517 |                        3 | d                    |       1731570520904425 | 100 |  1 |  1                10518 |                        2 | I                    |       1731570520909055 | 200 |  1 |  1                10519 |                        3 | B                    |       1731570520914102 | 200 |  1 |  1                10519 |                        4 | U                    |       1731570520914154 | 200 |  2 |  1
support.huaweicloud.com/HyDevg-910-dws/dws_15_00013.html