Skip to main content
ToraDB is the only retrieval database that shows its work. Every search can return a provenance DAG — a structured record of every candidate document at every retrieval tier, with scores, drop reasons, and latency breakdowns. This solves the most common debugging question in RAG systems: why didn’t the right document come back?

Enabling provenance

Pass explain=True to Table.search:
Or with SQL:

Provenance record schema

Retrieval tiers

Drop stages

Common debugging patterns

Find a specific document’s fate

Compare BM25 vs HNSW agreement

Measure tier latency (future)

latency_us on each TierTrace is reserved for per-tier timing — currently emitted as 0 and will be populated in a future release. Use total_latency_ms for end-to-end wall time.

Persistent search log

Every search with explain=True appends a JSON record to <db>/<table>/_search_log.ndjson. This file is newline-delimited JSON (one record per line).
This enables cross-query analysis: find documents that consistently drop before the final results, identify which tier is slowest, or A/B test retrieval strategy changes.

SQL provenance

EXPLAIN on a retrieval query in SQL executes the search and returns the provenance JSON as the explanation text:
For analytics queries (COUNT(*), GROUP BY), EXPLAIN still returns a plan string rather than provenance.