FREEZE
FREEZE is a command used in SQL for databases, specifically in PostgreSQL. It is used to mark rows as frozen early in a transaction, thus reducing the need for future vacuuming operations.
Example
Output
Explanation
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.