Contents
pg_integrity_checksums - Multi-Level Data Integrity Extension for PostgreSQL
Overview
pg_integrity_checksums provides page, cell, tuple, table, index and database checksums. Page checksums are physical; cell checksums are logical; the other levels support both physical and logical modes.
Logical checksums are canonical across endianness, VACUUM/REINDEX/physical movement and database OIDs. Physical checksums are for on-disk corruption in one specific cluster.
The legacy SQL API uses FNV-1a 32-bit. Generic overloads add FNV-1a 64-bit
and return raw bytea digests:
SELECT encode(pg_table_logical_checksum('public.orders'::regclass, 'fnv64'), 'hex');
SELECT pg_checksum_bigint(pg_table_logical_checksum('public.orders'::regclass, 'fnv64'));
Page checksums remain PostgreSQL’s built-in 32-bit page checksum.
Quick start
CREATE EXTENSION pg_integrity_checksums;
SELECT pg_table_logical_checksum('public.orders'::regclass);
Install from packages, Docker, PGXN or build with PGXS:
git clone https://github.com/VictorNagibator/pg_integrity_checksums.git
cd pg_integrity_checksums
make
sudo make install
The CLI lives in cli/:
cd cli
go build ./cmd/pg_integrity_checksums
pg_integrity_checksums capture --db "$DATABASE_URL" --output baseline.json
pg_integrity_checksums verify --db "$DATABASE_URL" --baseline baseline.json
Add --hash fnv64 to capture for a v2 baseline with 64-bit digests.
Documentation
- Documentation site
- Architecture
- Installation
- Functions and algorithms
- CLI documentation
- Operations
- Testing and releases
- Troubleshooting
- CLI changelog
- Extension changelog
- Migration from 1.x