pg_surgery

A contrib module providing tools for performing corrective action on potentially corrupted data
This entry relates to a PostgreSQL feature which is part of PostgreSQL 14, due to be released in late 2021.

pg_surgery is a contrib module providing tools for performing corrective action on potentially corrupted data.

pg_surgery was added in PostgreSQL 14 (commit 34a947ca).

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 tuples
  • heap_force_freeze() for forcing a tuple to become all-visible

Additional functionality may be added in future versions.

Categories

Contrib module, Dangerous thing, PostgreSQL internals

See also

pg_resetwal