---
title: "Indexing sparse vectors with Turso"
description: "Turso 0.3.0 adds a compact sparse vector representation (vector32_sparse) that uses 5–50x less storage than dense vectors, plus an inverted index for nearest-neighbor search by weighted Jaccard distance."
url: "https://swe.quest/articles/indexing-sparse-vectors-with-turso-3c9fdb0f1a894948"
canonical: "https://turso.tech/blog/indexing-sparse-vectors-with-turso"
source: "Turso"
published: "2025-11-05"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 8
tags: ["vector-search","sqlite","query-engines","algorithms","performance"]
---

# Indexing sparse vectors with Turso

A post on [Turso](https://swe.quest/sources/turso.md), published 2025-11-05, 8 min read, Deep dive. Original: [https://turso.tech/blog/indexing-sparse-vectors-with-turso](https://turso.tech/blog/indexing-sparse-vectors-with-turso)

## Summary

Turso 0.3.0 adds a compact sparse vector representation (vector32\_sparse) that uses 5–50x less storage than dense vectors, plus an inverted index for nearest-neighbor search by weighted Jaccard distance. The index plugs in through a new Index Method mechanism that, unlike SQLite VTables, integrates custom access methods into the query planner via SQL query patterns. Two approximations trade speed for accuracy: frequency-based selection of the rarest p% of query components, and adaptive length filtering with a bounded error Δ. On 400k TF-IDF vectors from Amazon Reviews, brute force took 448ms and 269ms. The exact index brought short queries down to 31ms, and length filtering with Δ\>0 reached 1.5–3ms with good recall@5, while long queries benefited more from component selection.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Query engines](https://swe.quest/tags/query-engines.md) (Data & databases)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- vector similarity search ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))
- inverted indexes
- SQLite query planning ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- TF-IDF

## Keywords

Turso, SQLite, Weighted Jaccard distance, Index Method, inverted index, TfidfVectorizer, SIMD

## Related posts

- [Turso brings Native Vector Search to SQLite](https://swe.quest/articles/turso-brings-native-vector-search-to-sqlite-524b5f374ac6abee.md): Turso · 2024-06-05 · Medium · 5 min read · Vector search, SQLite, Multi-tenancy
  libSQL, the SQLite fork behind Turso, now has native vector similarity search exposed as a column type (F32\_BLOB) instead of an extension like sqlite-vss.
- [Approximate nearest neighbor search with DiskANN in libSQL](https://swe.quest/articles/approximate-nearest-neighbor-search-with-diskann-in-libsql-f704916b9c7db474.md): Turso · 2024-07-26 · Medium · 7 min read · Vector search, SQLite, Storage engines, Algorithms
  libSQL implements approximate nearest neighbor search using LM-DiskANN, a low-memory variant of DiskANN.
- [SQLite Retrieval Augmented Generation and Vector Search](https://swe.quest/articles/sqlite-retrieval-augmented-generation-and-vector-search-f6665825b9a1cb47.md): Turso · 2024-06-21 · Medium · 5 min read · Vector search, SQLite, RAG & retrieval
  Retrieval-augmented generation fixes stale or hallucinated LLM answers by retrieving relevant data, typically via embeddings and vector similarity search, and injecting it into the prompt. libSQL adds native vector search to SQLite: embeddings are stored in an F32\_BLOB column (SQLite treats column types as hints), inserted with a vector() function, and queried with vector\_distance\_cos() plus ORDER BY/LIMIT for exact top-k results.
- [The space complexity of vector indexes in LibSQL](https://swe.quest/articles/the-space-complexity-of-vector-indexes-in-libsql-c0acaa3c84f4d05b.md): Turso · 2024-10-03 · Medium · 5 min read · Vector search, SQLite, Mobile, RAG & retrieval
  LibSQL's built-in vector index uses LM-DiskANN, a disk-oriented graph ANN algorithm that stores neighbor graphs in shadow tables.
- [You Don't Need A Separate Vector Database](https://swe.quest/articles/you-don-t-need-a-separate-vector-database-3c832a16be076ef3.md): Turso · 2024-11-04 · Easy · 4 min read · Vector search, SQLite, Databases, RAG & retrieval
  Vector search belongs in your primary database rather than a separate system like Pinecone, because syncing embeddings across multiple stores adds cost and operational complexity.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
