GS_TXN_LSN_TIME
GS_TXN_LSN_TIME records the mapping between logical decoding commit sequence numbers, log sequence numbers, and timestamps. In a distributed environment, it contains data only on DNs.
Column |
Type |
Description |
---|---|---|
create_csn |
bigint |
Commit sequence number. |
create_lsn |
bigint |
Log sequence number. |
snp_xmin |
bigint |
Minimum snapshot ID. |
snp_snapshot |
text |
Serialized snapshot text. |
barrier |
text |
Barrier information. |
create_time |
timestamp with time zone |
Timestamp when a tuple is inserted. |

- create_lsn is stored as a number in the system catalog. An LSN can be converted to the common LSN format (for reference only), that is, XXXXXXXX/XXXXXXXX, using the SQL syntax. The conversion syntax is as follows:
SELECT CONCAT(to_hex(({lsn_num}::bigint >> 32) & x'ffffffff'::bigint), '/', to_hex(({lsn_num}::bigint << 32 >> 32) & x'ffffffff'::bigint));
When using the preceding SQL statement, convert lsn_num to the required number. The following uses 607906688 as an example:
gaussdb=# SELECT CONCAT(to_hex((607906688::bigint >> 32) & x'ffffffff'::bigint), '/', to_hex((607906688::bigint << 32 >> 32) & x'ffffffff'::bigint)); concat ------------ 0/243beb80 (1 row)
- The M-compatible syntax is different from the GaussDB syntax. Therefore, in an M-compatible database, you need to perform the following conversion:
SELECT CONCAT(hex(({lsn_num} >> 32) & 4294967295), '/', hex((({lsn_num}<< 32) >> 32) & 4294967295));
When using the preceding SQL statement, convert lsn_num to the required number. The following uses 607906688 as an example:
gaussdb_m=# SELECT CONCAT(hex((607906688 >> 32) & 4294967295), '/', hex(((607906688 << 32) >> 32) & 4294967295)); concat ------------ 0/243BEB80 (1 row)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.