query_sql runs SQL across every table in the catalog. It is read-only: use it to
filter, aggregate, and join your rows, and to run Infino’s search table functions
(BM25, vector, hybrid, and exact/token match) as relations you compose with SQL. Mutate
data with append / update / delete (see Tables), not SQL.
Dialect
Infino executes SQL on Apache DataFusion. The dialect is ANSI-style and Postgres-leaning. You getSELECT, WHERE, JOIN (across tables), CTEs (WITH),
GROUP BY with aggregates, window functions, ORDER BY, LIMIT, and the usual
scalar/aggregate functions.
Search table functions
Call a search function in theFROM clause as a relation. Every one takes a leading
table-name argument (a string literal naming the catalog table to search) and returns that
table’s _id, its scalar columns, and a score column. The ranked functions
return rows best first. Their scores point in different directions, so when you re-sort
after a join or filter, match the function:
bm25_searchandhybrid_search: higher is better, soORDER BY score DESC. A hybrid score is the reciprocal rank fusion of the two rankings, not a BM25 or distance value.vector_search:scoreis the distance under the index’s metric (cosine distance for a cosine index), so lower is closer:ORDER BY score ASC.
mode(BM25, token):'or'(default, match any term) or'and'(require all terms).vector: the query embedding, as a comma-separated string literal ('0.12,0.04,-0.31,...') or a SQL array literal ([0.12, 0.04, -0.31, ...]).token_match/exact_matchare unranked:scoreis present (for schema uniformity) but constant0.0, and order is unspecified, so useORDER BY/LIMIT. Both read the full-text index, socolumnmust be one you declared as an FTS column; naming an unindexed column fails withno full-text index for column. To match on a column without an index, filter it with plain SQL (WHERE doc_id = '42').
Examples
Composing search with SQL
Each function returns a relation, so you can filter, join, and aggregate over its results:WHERE on the search function’s own columns, like s.source above, is applied inside
the search: the function ranks only the matching rows and returns the top k of those.
This holds for bm25_search, vector_search and hybrid_search, and it is how to scope
a search to one tenant or category. A predicate on a joined table such as users runs
after the top k is chosen, so raise k when that filter is selective.
SQL is read-only.
INSERT / UPDATE / DELETE / CREATE are not available; create
tables and mutate rows through the API (create_table, append, update, delete).