amcheck
functions for verifying relation integrity
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
amcheck | 1.4 | ADMIN | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5980 | amcheck | No | Yes | No | Yes | No | No | - |
| Related | pg_checksums pg_catcheck pg_orphaned pg_pathcheck pg_isok pg_surgery pageinspect adminpack pg_repack |
|---|
Version
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.4 | 1.4 | 1.4 | 1.4 | 1.4 |
Install
Note: This is a built-in contrib extension of PostgreSQL
Usage
The amcheck extension provides functions to verify the logical consistency of B-tree indexes, GIN indexes, and heap (table) data, detecting corruption without modifying data.
B-Tree Index Verification
Check All Catalog Indexes
GIN Index Verification
Heap (Table) Verification
Returns rows for each detected problem:
| Column | Type | Description |
|---|---|---|
blkno | bigint | Block number with corruption |
offnum | integer | Offset of corrupt tuple |
attnum | integer | Attribute number (if column-specific) |
msg | text | Description of the problem |
Function Summary
| Function | Lock | Use Case |
|---|---|---|
bt_index_check(index, heapallindexed, checkunique) | AccessShareLock | Routine production checks |
bt_index_parent_check(index, heapallindexed, rootdescend, checkunique) | ShareLock | Comprehensive verification |
gin_index_check(index) | AccessShareLock | GIN index verification |
verify_heapam(relation, on_error_stop, check_toast, skip, startblock, endblock) | AccessShareLock | Table/heap corruption detection |
All amcheck errors are true positives. Use REINDEX or point-in-time recovery for repair after diagnosing with pageinspect.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)