Updated on 2025-05-29 GMT+08:00

GS_TXN_LSN_TIME

GS_TXN_LSN_TIME records the mapping between logical decoding commit sequence numbers, log sequence numbers, and timestamps.

Table 1 GS_TXN_LSN_TIME columns

Column

Type

Description

create_csn

bigint

Commit sequence number.

create_lsn

bigint

Log serial 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 469920056 as an example:
    gaussdb=# SELECT CONCAT(to_hex((469920056::bigint >> 32) & x'ffffffff'::bigint), '/', to_hex((469920056::bigint << 32 >> 32) & x'ffffffff'::bigint));
    concat
    ------------
    0/1c026938
    (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 469920056 as an example:

    gaussdb_m=# SELECT CONCAT(hex((469920056 >> 32) & 4294967295), '/', hex(((469920056 << 32) >> 32) & 4294967295));
       concat
    ------------
     0/1c026938
    (1 row)