LSN (Log Sequence Number)
LSN (Log Sequence Number) is an unsigned 64-bit integer used to determine a position in WAL. Internally it is represented by the pointer type XLogRecPtr. Externally it is represented as two hexadecimal numbers of up to eight digits each separated by a slash.
To calculate the difference (in bytes) between two LSNs, from PostgreSQL 9.4 simply subtract one value from the other, casting to
pg_lsn if necessary. The function
pg_wal_lsn_diff() (PostgreSQL 9.6 and earlier:
pg_xlog_location_diff()) can also be used for this.