Extensions
- pg_integrity_checksums 2.5.0
- Checksum functions at page, cell, tuple, table, index and database level
Documentation
- getting-started
- Getting started
- CODE_OF_CONDUCT
- Contributor Covenant Code of Conduct
- architecture
- Architecture and internals
- concepts
- Concepts
- troubleshooting
- Troubleshooting
- CONTRIBUTING
- Contributing
- bug_report
- bug_report
- operations
- Operations
- requirements-docs
- requirements-docs
- testing
- Testing and releases
- pull_request_template
- pull_request_template
- SECURITY
- Security Policy
- README
- pg_integrity_checksums CLI
- feature_request
- feature_request
- functions
- Functions and algorithms
- MIGRATION
- Migrating from pg_checksums 1.x
- index
- PostgreSQL integrity checks you can run online
- installation
- Installation
- cli
- pg_integrity_checksums CLI
README
Contents
pg_integrity_checksums - Multi-Level Data Integrity Extension for PostgreSQL
Overview
pg_integrity_checksums provides cell, tuple, table, index and database checksums. Cell checksums are logical; tuple, table, index and database checksums 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 default SQL API uses FNV-1a 32-bit and returns ordinary SQL integers:
SELECT pg_table_logical_checksum('public.orders'::regclass);
SELECT pg_table_physical_checksum('public.orders'::regclass, false);
A generic API with explicit FNV-1a 32-bit or 64-bit digests is available when a
wider checksum or a raw bytea value is required. It is described in the
function reference.
Errors and skipped relations
Database-level checksums are strict by default (since 2.5): if a relation
cannot be checksummed (an invalid index, a corrupt page, an unlogged table on a
standby), the call fails and names the relation, instead of returning a value
that silently leaves it out. SET pg_integrity_checksums.strict = off skips
such relations with a warning; do not use that value for monitoring. See
Strict mode.
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
The CLI uses the 32-bit v1 baseline format by default. Add
--hash fnv64 to capture when you explicitly need a 64-bit v2 baseline.
Documentation
- Documentation site
- Getting started
- Installation
- Concepts
- Function reference
- Architecture
- CLI documentation
- Operations
- Testing and releases
- Troubleshooting
- CLI changelog
- Extension changelog
- Migration from 1.x
Compatibility
The 32-bit numeric SQL functions are the default and remain fully supported,
as are v1 baselines. The optional generic API adds explicit fnv32/fnv64
digests and v2 baselines; see Functions and algorithms
and Concepts for selection guidance.