Skip to content

pg_recall_guard

Measure ANN index recall and detect drift from an approved baseline

pg_recall_guard · Measure ANN index recall and detect drift from an approved baseline

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101856pg_recall_guardpg_recall_guard0.2.11RAGApache-2.0PLpgSQL

PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18, 19

Usage

Sources:

pg_recall_guard 0.2.11 measures approximate-nearest-neighbour recall against exact scans and records approved index baselines. It discovers distance operators from PostgreSQL catalogs and no longer requires tsm_system_rows.

Core Workflow

CREATE EXTENSION pg_recall_guard;

SELECT index_name, table_name, access_method, operator
FROM recall_guard.vector_indexes;

SELECT recall_guard.approve(
    'items_hnsw',
    p_k => 10,
    p_sample_size => 30
);

SELECT * FROM recall_guard.check();

Operational Boundaries

recall_guard.vector_indexes lists eligible indexes. recall_guard.approve() stores a measurement and search settings; recall_guard.check() reuses those settings, and recall_guard.measure() performs an individual comparison. Equal-distance neighbours count as hits, so baselines approved under the old duplicate-vector behaviour may need re-approval. The sample is drawn from non-NULL vectors; k is 1–1000 and sample_size is 1–10000. Partial, expression and temporary indexes are refused. Row security limits baseline/measurement access to readable tables. Each sample performs exact work and holds a relation lock, so schedule conservatively. Samples are not real query traffic, and name-based baselines can outlive index replacement. The 0.2.11 source documents tests on PostgreSQL 10–19. This is pure SQL without preload; current Apache-2.0 licensing starts at 0.2.3.

0.2.10 Dependency and Monitoring Changes

Version 0.2.10 no longer requires tsm_system_rows; measure() uses PostgreSQL sampling and the extension installs without CASCADE. A monitoring role may measure again because _search_settings() is available to the documented grants. Install the extension directly, then keep tsm_system_rows only if another workload needs it.

Verdict Changes in 0.2.9

Version 0.2.9 changes the values returned by recall_guard.check(): degradado becomes degraded, critico becomes critical, and NO SE PUDO MEDIR: <error> becomes COULD NOT MEASURE: <error>; ok is unchanged. Update monitoring filters that match the old words. The upgrade restates functions and comments in English, without adding or removing public objects.

Current Compatibility

Version 0.2.11 updates documentation and tested compatibility without changing SQL objects. Upstream records PostgreSQL 10–19 coverage. The supplied 0.2.10-to-0.2.11 SQL update advances the extension version only; keep the earlier role and dependency requirements above.

Table reader