RAG in SQL: Graph + BM25 + Hybrid + RRF/MMR, All in HeliosDB Lite v3.6
Editor's note (2026-10-15): This May 2026 post describes the design for the Lite 3.6 line, not what Lite 3.6.0 serves. In HeliosDB Lite 3.6.0, graph traversal, BM25 ranking and hybrid search as SQL functions, PREPARE COMPILED cached plans and an MCP server are planned; Lite 3.6.0 serves PostgreSQL wire and REST. Hybrid search ships today in HeliosDB Nano, through its MCP server (a build-from-source feature), and in HeliosDB Full, over the HTTP vector-store API. See HeliosDB Lite.
The standard RAG stack in 2026 is four products: a vector database (Pinecone, Qdrant, Weaviate), a full-text engine (Elasticsearch, OpenSearch), a graph database (Neo4j, NebulaGraph), and an orchestration layer (LangChain, LlamaIndex) gluing them together. HeliosDB Lite v3.6.0 ships all four behind one SQL surface. This post walks through the surface, not the internals.
Graph traversal in SQL
Three traversal primitives ship as table functions: BFS with a bounded depth, Dijkstra-style shortest-path, and A* with a configurable heuristic. They operate on a directed, typed, optionally-weighted edge model.
SELECT * FROM graph_bfs('symbols', 'fn:render', max_depth => 4);
SELECT * FROM graph_shortest_path('symbols', 'fn:a', 'fn:b');
SELECT * FROM graph_a_star('cities', 'NYC', 'LA', heuristic => 'haversine');
SELECT * FROM graph_neighbors('symbols', 'fn:render');
Persistent edge stores (durable across restarts, branch-aware) land in v3.7; the v3.6 surface above is stable.
BM25, hybrid search, RRF, and MMR
BM25 over a tokenised text index, with a bloom-filter skip optimization for high-cardinality term lookups so the postings list isn't touched on miss. Hybrid search fuses BM25 with vector results via Reciprocal Rank Fusion or weighted linear combination, then optionally diversifies the top-k with Maximal Marginal Relevance.
-- BM25 only
SELECT id, score FROM bm25_search('articles', 'rust async runtime', limit => 50);
-- Hybrid: 70% vector + 30% BM25, RRF fusion, MMR diversification
SELECT id, score
FROM hybrid_search(
'chunks',
query_text => 'time-travel queries',
query_vector => '[0.1, 0.2, ...]'::vector,
weight_vector => 0.7,
weight_bm25 => 0.3,
fusion => 'rrf',
rerank => 'mmr',
lambda => 0.5,
limit => 10
);
Tuning knobs (weight_*, fusion, rerank, lambda) are all explicit at the call site — no global configuration to drift.
Compiled query plans
PREPARE COMPILED foo AS … + EXECUTE COMPILED foo (…) — an engine-wide plan cache shared across sessions, fingerprint-keyed and LRU-bounded. Detailed walkthrough in next week's post.
MCP enhancements
Four new MCP tools ship out of the box for Claude Code, Cursor, Continue, and any MCP-aware agent: heliosdb_graph_neighbors, heliosdb_graph_shortest_path, heliosdb_search_bm25, heliosdb_search_hybrid. Plus two resources: helios://graph/stats and helios://search/index_stats. Turn on Lite's MCP server and the agent sees them automatically.
What this collapses
A Pinecone + Elasticsearch + Neo4j + LangChain stack is four operational surfaces, four sets of credentials, four query languages, and a synchronisation problem. The Lite v3.6 surface is one Postgres-wire connection. You don't gain "graph database features" in your relational schema — you gain a database that already had them.
HeliosDB Lite is source-available under SSPL-1.0; licensed customers receive the source distribution through sales@ (show).