Member-only story
SQLite Gets Smarter: Vector Search with sqlite-vec v0.1.6
2 min readNov 24, 2024
SQLite, already a beloved lightweight database, has just become a lot smarter with sqlite-vec. With the latest v0.1.6 update, this plugin now supports storing metadata in vector tables and introduces features that make vector search queries more powerful and efficient. Let’s dive into the exciting possibilities this release unlocks!
What’s New in sqlite-vec v0.1.6?
- Store Metadata Directly in vec0 Tables
- You can now include non-vector data like
user_id
,created_at
, or other fields directly invec0
tables. - These metadata columns can be used in WHERE clauses of KNN queries, enabling precise filtering of search results.
SELECT article_id, headline, news_desk, distance
FROM vec_articles
WHERE headline_embedding MATCH lembed('pandemic')
AND k = 8
AND year = 2020
AND news_desk IN ('Sports', 'Business')
AND word_count BETWEEN 500 AND 1000;
This lets you retrieve highly targeted results based on both vector and metadata filters.
- Partition Keys for Faster Queries
Partitioning the vector index by a key (e.g., year or user ID) significantly speeds up queries by pre-filtering rows. Perfect for large datasets, as it avoids scanning the entire table.