Skip to content

FREEZE

CREATE TABLE test (a INT);
INSERT INTO test VALUES (1), (2), (3), (4), (5);
VACUUM FREEZE test;
SELECT pg_frozen_xid_current();
pg_frozen_xid_current
-----------------------
10000
(1 row)

In the above code, a test table is created, and five integer records are inserted into the table. The VACUUM FREEZE test; command executes the FREEZE operation on the test table. The FREEZE operation marks all rows in the table as frozen, which means they will not be subject to transaction ID wraparound.

The SELECT pg_frozen_xid_current(); command is used to retrieve the current transaction ID, showing that the transaction has been frozen.