Glowing blue spheres floating in the dark, like embeddings as points in space that vector search compares by distance
Photo by jonakoh on Unsplash · source · credits

Turso Vector Search: Add Semantic Search to a SQLite Database Without an Extension

Also available in Hindi: यह लेख हिंदी में पढ़ें

If your app already keeps its data in SQLite, you may not need a separate vector database for RAG. Turso's libSQL engine has vector search built in: embeddings sit in a normal table next to your rows, and an index finds the nearest ones. No extension to load.

Create a libSQL database

turso db create my-db
turso db shell my-db

Turso Cloud now hosts two engines. Plain turso db create gives you libSQL, the SQLite fork Turso has run in production for years. Adding --tursodb creates a database on the new Turso engine, which is in early preview on Turso Cloud. That choice matters for vector search, as the table below shows.

Turso libSQL vs Turso engine for vector search
From Turso docs and the turso COMPAT.md list. Illustration, not a screenshot.

Store embeddings next to your data

CREATE TABLE notes (
  id INTEGER PRIMARY KEY,
  body TEXT,
  embedding F32_BLOB(3)
);
INSERT INTO notes (body, embedding) VALUES
  ('refund policy', vector32('[0.9, 0.1, 0.0]')),
  ('shipping times', vector32('[0.1, 0.9, 0.0]'));

F32_BLOB(3) means 32-bit floats with exactly 3 dimensions. Real embeddings have hundreds or thousands, so use the number your embedding model returns. Turso suggests FLOAT32 as the starting type; FLOAT8 and FLOAT1BIT save space at some precision cost. The limit is 65,536 dimensions.

Build the index and query it

Turso vector search steps: create, column, insert, index, query
From Turso docs (Quickstart, AI & Embeddings). Illustration, not a screenshot.
CREATE INDEX notes_idx ON notes (libsql_vector_idx(embedding));

SELECT n.body
FROM vector_top_k('notes_idx', vector32('[0.85, 0.15, 0.05]'), 2) AS v
JOIN notes AS n ON n.id = v.id;

The index uses the DiskANN algorithm, which is approximate: it trades a little accuracy for speed on large tables. It fills itself from existing rows and stays in sync with inserts and updates. Cosine distance is the default; pass 'metric=l2' for Euclidean.

Errors you will probably hit

The free plan includes 100 databases, 5 GB of storage and 500 million rows read a month. Compare Chroma for local RAG, Qdrant hybrid search and the best database for side projects, or visit the Turso tool page.

Sources

FAQ

Do I need a SQLite extension for vectors?

No. Vector types and functions are built into libSQL on Turso.

Is the vector index exact?

No. DiskANN is approximate nearest neighbor search; it can miss a close match on large tables.

Can I filter by other columns?

Yes. Join the index results to your table and add WHERE conditions, or build a partial index.

Which vector type should I start with?

FLOAT32 (F32_BLOB). Try FLOAT8 or FLOAT1BIT only when storage becomes a problem.

About the author

Suraj Kumar builds and edits AIUseFlow, a directory of AI tools for vibe coders, agent builders and creators. Guides like this one walk through a practical workflow with cited sources — not a news wire rewrite. How we rank tools.

Get the weekly stack

Rank movers and new AI tools for builders, once a week. Free, no spam, unsubscribe anytime.