In Postgres, each row has a system column xmin
which holds the ID of the first transaction to have visibility over that row.
Conversely, the xmax
system column holds the ID of last trasaction to have visibility over that row.
DROP TABLE IF EXISTS users;
CREATE TABLE users (name varchar(80)) WITH OIDS;
INSERT INTO users VALUES ('root');
SELECT oid, xmin, xmax, name FROM users;
oid | xmin | xmax | name
-------+------+------+------
16398 | 602 | 0 | root
(1 row)
UPDATE users SET name = 'ssilva' WHERE name = 'root';
SELECT oid, xmin, xmax, name FROM users;
oid | xmin | xmax | name
-------+------+------+--------
16398 | 603 | 0 | ssilva
(1 row)