Reference

Hybrid query matrix

Hybrid query planning combines bounded candidate drivers and bounded verification. The supported families are scalar filters, document selectors, raw text/trigram predicates, full-text/BM25-style predicates, and vector ANN ordering.

Example hybrid table

CREATE TABLE app.docs (
  id text PRIMARY KEY,
  tenant text,
  category text,
  title text,
  body text,
  doc document,
  embedding vector<float, 2>
);

Base descriptors

CREATE INDEX docs_tenant_idx
ON app.docs (tenant)
USING 'sis'
WITH OPTIONS = {'family':'auto'};

CREATE INDEX docs_doc_category_idx
ON app.docs (doc_get_text(doc, '$.category'))
USING 'sis'
WITH OPTIONS = {'family':'auto'};

CREATE ACCESS PATH docs_title_trigram
ON app.docs
USING TRIGRAM_TEXT_SIS(title)
WITH (
  case_mode = 'sensitive',
  normalization_contract = 'raw_utf8_bytes_v1',
  regex_dialect = 'mts_regex_v1'
);

CREATE INDEX docs_body_fulltext
ON app.docs (body AS body)
USING 'sis'
WITH OPTIONS = {
  'mode':'FULLTEXT',
  'analyzer':'english_v1',
  'positions':'true',
  'max_indexed_value_bytes':'256'
};

CREATE INDEX docs_embedding_idx
ON app.docs (embedding)
USING 'sis'
WITH OPTIONS = {'search_mode':'exact','budget':'64'};

Hybrid descriptors

CREATE ACCESS PATH docs_scalar_doc
ON app.docs
USING HYBRID
WITH (
  driver_candidates = 'scalar(tenant)',
  filters = 'doc_get_text(doc, ''$.category'')',
  budget = 'bounded'
);
CREATE ACCESS PATH docs_raw_tenant_doc
ON app.docs
USING HYBRID
WITH (
  driver_candidates = 'text(title)',
  filters = 'tenant,doc_get_text(doc, ''$.category'')',
  budget = 'bounded'
);
CREATE ACCESS PATH docs_vec_tenant_doc
ON app.docs
USING HYBRID
WITH (
  driver_candidates = 'vector(embedding)',
  filters = 'tenant,doc_get_text(doc, ''$.category'')',
  budget = 'bounded',
  search_mode = 'exact'
);
CREATE ACCESS PATH docs_text_tenant_doc
ON app.docs
USING HYBRID
WITH (
  driver_candidates = 'fulltext(body)',
  filters = 'tenant,doc_get_text(doc, ''$.category'')',
  fulltext.analyzer = 'english_v1',
  fulltext.ranking = 'bm25_v1',
  budget = 'bounded'
);
CREATE ACCESS PATH docs_mixed_raw_tenant_doc
ON app.docs
USING HYBRID
WITH (
  driver_candidates = 'vector(embedding),fulltext(body),text(title)',
  filters = 'tenant,doc_get_text(doc, ''$.category'')',
  fulltext.analyzer = 'english_v1',
  fulltext.ranking = 'bm25_v1',
  budget = 'bounded',
  search_mode = 'exact'
);

Hybrid query shapes

Combination Query shape
Scalar + documentWHERE tenant = 'tenant-alpha' AND doc_get_text(doc, '$.category') = 'returns' LIMIT 10
Scalar + raw text/trigramWHERE tenant = 'tenant-alpha' AND title LIKE '%refund%' LIMIT 10
Scalar + full textWHERE tenant = 'tenant-alpha' AND body MATCH 'refund' LIMIT 10
Scalar + vectorWHERE tenant = 'tenant-alpha' ORDER BY embedding ANN OF [0.0, 0.0] WITH (topk = 10) LIMIT 10
Document + raw textWHERE doc_get_text(doc, '$.category') = 'returns' AND title LIKE '%refund%' LIMIT 10
Document + full textWHERE doc_get_text(doc, '$.category') = 'returns' AND body MATCH 'refund' LIMIT 10
Document + vectorWHERE doc_get_text(doc, '$.category') = 'returns' ORDER BY embedding ANN OF [0.0, 0.0] WITH (topk = 10) LIMIT 10
Raw text + vectorWHERE title LIKE '%refund%' ORDER BY embedding ANN OF [0.0, 0.0] WITH (topk = 10) LIMIT 10
Full text + vectorWHERE body MATCH 'refund' ORDER BY embedding ANN OF [0.0, 0.0] WITH (topk = 10) LIMIT 10
Full hybridScalar, document selector, raw text/trigram, full text, and vector ANN in one bounded query.

Full hybrid:

SELECT tenant, id, category, title, body
FROM app.docs
WHERE tenant = 'tenant-alpha'
  AND doc_get_text(doc, '$.category') = 'returns'
  AND title LIKE '%refund%'
  AND body MATCH 'refund'
ORDER BY embedding ANN OF [0.0, 0.0]
WITH (topk = 10)
LIMIT 10;

Prepared MTS SQL full hybrid:

SELECT tenant, id, category, title, body
FROM app.docs
WHERE tenant = $1
  AND doc_get_text(doc, '$.category') = $2
  AND title LIKE $3
  AND body MATCH $4
ORDER BY embedding ANN OF $5
WITH (topk = 10)
LIMIT 10;

Hybrid refusal examples

Refusal shape Why it refuses
Too-short raw text patternTrigram evidence is not selective enough.
Empty MATCHFull-text driver has no safe query terms.
topk = 0Vector result bound is invalid.
ALLOW FILTERING on hybridIt asks the OLTP endpoint to bypass bounded planning.
Changed query on page replayContinuation identity no longer matches.
Missing descriptorNo queryable driver exists for the candidate family.