amcheck-style index verification functions to detect corruption and validate the structural integrity of ParadeDB indexes.
These functions are useful for:
- Proactive corruption detection before issues become critical
- Validating index health after hardware failures or unexpected shutdowns
- Verifying backup integrity
- Debugging index-related issues
Basic Verification
Thepdb.verify_index function performs structural integrity checks on a ParadeDB index:
Example Output
Heap Reference Validation
To verify that all indexed entries still exist in the heap table, use theheapallindexed option:
ctid (tuple identifier) references a valid row in the table.
This is particularly useful for detecting index entries that reference deleted or non-existent rows.
Options
Sampling for Large Indexes
For large indexes, you can check a random sample of documents instead of all documents:Progress Reporting
For long-running verifications, enable progress reporting to see status updates:NOTICE channel.
Verbose Mode
For detailed logging including segment-by-segment progress and resume hints, enable verbose mode:Stop on First Error
To stop verification immediately when the first error is found (similar topg_amcheck --on-error-stop):
Parallel Verification
A singleverify_index call processes segments sequentially within one PostgreSQL backend.
For very large indexes, you can distribute verification across multiple database connections
by specifying which segments each connection should check using the segment_ids parameter.
This allows you to utilize multiple CPU cores by running verification in parallel processes.
Listing Segments
First, list all segments in the index:Verifying Specific Segments
Then verify specific segments using thesegment_ids parameter:
Automation Example
Distribute verification across N workers:Verifying All ParadeDB Indexes
To verify all ParadeDB indexes in the database at once:Filtering by Pattern
Filter indexes by schema or name pattern (using SQLLIKE syntax):
Listing All ParadeDB Indexes
To see all ParadeDB indexes in the database with summary statistics:Index Build Time
To see the wall-clock time a ParadeDB index was built at:SQL
0.24.2 and up. Indexes created before upgrading to 0.24.2 will return NULL.
Function Reference
pdb.verify_index
Verifies a single ParadeDB index.
pdb.verify_all_indexes
Verifies all ParadeDB indexes in the database.
pdb.index_segments
Lists all segments in a ParadeDB index.
Returns:
pdb.indexes
Lists all ParadeDB indexes in the database.
Returns:
paradedb.index_created_at
Returns the wall-clock time the given ParadeDB index was built. Supported on ParadeDB 0.24.2 and up; indexes created before upgrading to 0.24.2 return NULL.
Returns a
timestamp with time zone.