Skip to content

PostgreSQL integrity checks you can run online

pg_integrity_checksums is a PostgreSQL extension and CLI for checking data integrity at page, cell, tuple, table, index and database level.

It provides logical checksums that stay stable across VACUUM, REINDEX, OID changes and physical row movement, plus physical checksums for on-disk corruption within one cluster.

Get started Concepts CLI reference

What you can check

Level Physical Logical Example use
Page yes — Single-page corruption
Cell — yes One value in one row
Tuple yes yes Physical or logical row fingerprint
Table yes yes Data change detection, restore checks
Index yes yes Missing index entries vs corrupt pages
Database yes yes Whole-database fingerprint

Page checksums are PostgreSQL’s built-in 32-bit page checksum. The other levels use FNV-1a 32-bit by default and optionally expose 64-bit digests through the generic API.

First checksum

CREATE EXTENSION pg_integrity_checksums;

SELECT pg_table_logical_checksum('public.orders'::regclass);

The default functions return ordinary SQL integers. A 64-bit digest is available when needed:

SELECT encode(
    pg_table_logical_checksum('public.orders'::regclass, 'fnv64'),
    'hex'
);

See Concepts for when to choose 32-bit or 64-bit.

Why teams use it

  • Logical comparison across a restore, replica, migration or release.
  • Physical detection of corrupted pages, tuples, tables and indexes.
  • No primary key required for logical table and database checksums.
  • Partition-aware table and index checksums.
  • Parallel scans through pg_integrity_checksums.workers.
  • CI-friendly baselines from the companion CLI, with text, JSON and JUnit reports.

Choose your path

I want to... Read
Install and run my first checksum Getting started
Understand logical vs physical and 32-bit vs 64-bit Concepts
Look up a function Function reference
Use baselines in CI CLI reference
Understand performance and correctness limits Operations
Debug an error Troubleshooting
Understand the internals Architecture

What it is not

  • FNV-1a is not cryptographic; it is not tamper evidence.
  • Physical checksums are tied to one cluster and database.
  • Logical checksums describe content, not physical layout.
  • It does not replace backups, pg_checksums or amcheck.

Documentation

Source and issue tracker: github.com/VictorNagibator/pg_integrity_checksums.