Check BM25 indexes for corruption and structural issues
ParadeDB provides amcheck-style index verification functions to detect corruption and validate the structural integrity of BM25 indexes.
These functions are useful for:
Proactive corruption detection before issues become critical
Validating index health after hardware failures or unexpected shutdowns
await dbContext.Database.VerifyIndex( "search_idx", new VerifyIndexOptions { HeapAllIndexed = true }).ToListAsync();
This adds an additional check that validates every indexed 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.
The heapallindexed option can be slow on large indexes as it must verify
every document. Consider using sample_rate for quick spot checks on large
indexes.
A single verify_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.
-- Get segments for worker 0 (of 4 workers)SELECT array_agg(segment_idx) AS segmentsFROM pdb.index_segments('search_idx')WHERE segment_idx % 4 = 0;-- Run verification with those segmentsSELECT * FROM pdb.verify_index('search_idx', heapallindexed := true, segment_ids := ( SELECT array_agg(segment_idx) FROM pdb.index_segments('search_idx') WHERE segment_idx % 4 = 0 ));
from paradedb import paradedb_index_segments, paradedb_verify_indexparadedb_verify_index( "search_idx", heapallindexed=True, segment_ids=[ row["segment_idx"] for row in paradedb_index_segments("search_idx") if row["segment_idx"] % 4 == 0 ],)
from paradedb.sqlalchemy import diagnosticsdiagnostics.paradedb_verify_index( engine, "search_idx", heapallindexed=True, segment_ids=[ row["segment_idx"] for row in diagnostics.paradedb_index_segments(engine, "search_idx") if row["segment_idx"] % 4 == 0 ],)
Filter indexes by schema or name pattern (using SQL LIKE syntax):
-- Verify indexes in the 'public' schema onlySELECT * FROM pdb.verify_all_indexes(schema_pattern := 'public');-- Verify indexes matching a name patternSELECT * FROM pdb.verify_all_indexes(index_pattern := 'search_%');-- Combine filtersSELECT * FROM pdb.verify_all_indexes( schema_pattern := 'app_%', index_pattern := '%_idx', heapallindexed := true);
import { diagnostics } from "@paradedb/drizzle-paradedb";// Verify indexes in the 'public' schema onlyawait db.execute( diagnostics.verifyAllIndexes({ schemaPattern: "public", }),);// Verify indexes matching a name patternawait db.execute( diagnostics.verifyAllIndexes({ indexPattern: "search_%", }),);// Combine filtersawait db.execute( diagnostics.verifyAllIndexes({ schemaPattern: "public", indexPattern: "search_%", heapAllIndexed: true, }),);
from paradedb import paradedb_verify_all_indexes# Verify indexes in the 'public' schema onlyparadedb_verify_all_indexes(schema_pattern="public")# Verify indexes matching a name patternparadedb_verify_all_indexes(index_pattern="search_%")# Combine filtersparadedb_verify_all_indexes( schema_pattern="app_%", index_pattern="%_idx", heapallindexed=True,)
from paradedb.sqlalchemy import diagnostics# Verify indexes in the 'public' schema onlydiagnostics.paradedb_verify_all_indexes( engine, schema_pattern="public",)# Verify indexes matching a name patterndiagnostics.paradedb_verify_all_indexes( engine, index_pattern="search_%",)# Combine filtersdiagnostics.paradedb_verify_all_indexes( engine, schema_pattern="app_%", index_pattern="%_idx", heapallindexed=True,)
# Verify indexes in the 'public' schema onlyParadeDB.paradedb_verify_all_indexes(schema_pattern: "public")# Verify indexes matching a name patternParadeDB.paradedb_verify_all_indexes(index_pattern: "search_%")# Combine filtersParadeDB.paradedb_verify_all_indexes( schema_pattern: "app_%", index_pattern: "%_idx", heapallindexed: true)
// Verify indexes in the 'public' schema onlyawait dbContext.Database.VerifyAllIndexes( new VerifyAllIndexesOptions { SchemaPattern = "public" }).ToListAsync();// Verify indexes matching a name patternawait dbContext.Database.VerifyAllIndexes( new VerifyAllIndexesOptions { IndexPattern = "search_%" }).ToListAsync();// Combine filtersawait dbContext.Database.VerifyAllIndexes( new VerifyAllIndexesOptions { SchemaPattern = "public", IndexPattern = "search_%", HeapAllIndexed = true, }).ToListAsync();
Returns the wall-clock time the given BM25 index was built. Supported on ParadeDB 0.24.2 and up; indexes created before upgrading to 0.24.2 return NULL.