pg_surgery
A contrib module providing tools for performing corrective action on potentially corrupted data
pg_surgery
is a contrib module providing tools for performing corrective action on potentially corrupted data.
pg_surgery
was added in PostgreSQL 14.
IMPORTANT: pg_surgery
provides functions which directly modify the internal representation of individual tuples outside of the normal operating context and if used incorrectly may introduce corruption which did not previously exist.
Extreme caution is therefore necessary when using these functions. It is highly recommended to seek professional advice if you believe you need to use them but are not sure how.
Usage
As of PostgreSQL 14, pg_surgery
provides two functions:
heap_force_kill()
for truncating dead tuplesheap_force_freeze()
for forcing a tuple to become all-visible
Additional functionality may be added in future versions.
Change history
- PostgreSQL 14
- added (commit 34a947ca)
References
- PostgreSQL documentation: pg_surgery
Useful links
- PostgreSQL and Undelete - November 2021 blog article by Christoph Berg about pg_dirtyread and pg_surgery