{"data":{"slug":"asg017-sqlite-vss","name":"sqlite-vss","tagline":"A SQLite extension for efficient vector search based on Faiss","github_url":"https://github.com/asg017/sqlite-vss","owner":"asg017","repo":"sqlite-vss","owner_avatar_url":"https://avatars.githubusercontent.com/u/15178711?v=4","primary_language":"C++","stars":2001,"forks":75,"topics":["faiss","sqlite","sqlite-extension","vector-search"],"archived":false,"github_pushed_at":"2024-05-05T20:00:16+00:00","maintenance_label":"Dormant","stars_delta_30d":2,"url":"https://www.graphcanon.com/tools/asg017-sqlite-vss","markdown_url":"https://www.graphcanon.com/tools/asg017-sqlite-vss.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/asg017-sqlite-vss","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=asg017-sqlite-vss","description":"A SQLite extension for efficient vector search, based on Faiss!","homepage_url":null,"license":"MIT","open_issues":80,"watchers":29,"ai_summary":"This project is a C++ implementation of an SQLite extension that integrates Faiss for facilitating efficient vector similarity searches within database operations.","readme_excerpt":"# sqlite-vss\n\n\n> [!WARNING]  \n> `sqlite-vss` is not in active development. Instead, my effort is now going towards [`sqlite-vec`](https://github.com/asg017/sqlite-vec), which is a similar vector search SQLite extension, but should be much easier to install and use than `sqlite-vss`. See [this blog post](https://alexgarcia.xyz/blog/2024/building-new-vector-search-sqlite/index.html) for more info.\n>\n\n`sqlite-vss` (SQLite <b><u>V</u></b>ector <b><u>S</u></b>imilarity <b><u>S</u></b>earch) is a SQLite extension that brings vector search capabilities to SQLite, based on [Faiss](https://faiss.ai/). It can be used to build semantic search engines, recommendations, or questions-and-answering tools.\n\nSee [_Introducing sqlite-vss: A SQLite Extension for Vector Search_](https://observablehq.com/@asg017/introducing-sqlite-vss) (February 2023) for more details and a live example!\n\nIf your company or organization finds this library useful, consider [supporting my work](#supporting)!\n\n## Usage\n\n```sql\n.load ./vector0\n.load ./vss0\n\nselect vss_version(); -- 'v0.0.1'\n\n```\n\n`sqlite-vss` has a similar API to the [`fts5` Full-Text Search Extension](https://www.sqlite.org/fts5.html). Use the `vss0` module to create virtual tables that can efficiently store and query your vectors.\n\n```sql\n-- 384 == number of dimensions for this example\ncreate virtual table vss_articles using vss0(\n  headline_embedding(384),\n  description_embedding(384),\n);\n```\n\n`sqlite-vss` is a **Bring-your-own-vectors** database, it is compatable with any embedding or vector data you have. Consider using [OpenAI's Embeddings API](https://platform.openai.com/docs/guides/embeddings), [HuggingFace's Inference API](https://huggingface.co/blog/getting-started-with-embeddings#1-embedding-a-dataset), [`sentence-transformers`](https://www.sbert.net/), or [any of these open source model](https://github.com/embeddings-benchmark/mteb#leaderboard). In this example, we are using [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) to generate embeddings from our text, which have 384 dimensions.\n\nYou can insert vectors into `vss0` tables as JSON or raw bytes.\n\n```sql\ninsert into vss_articles(rowid, headline_embedding)\n  select rowid, headline_embedding from articles;\n```\n\nTo query for similar vectors (\"k nearest neighbors\"), use the `vss_search` function in the `WHERE` clause. Here we are searching for the 100 nearest neighbors to the embedding in row #123 in the `articles` table.\n\n```sql\nselect rowid, distance\nfrom vss_articles\nwhere vss_search(\n  headline_embedding,\n  (select headline_embedding from articles where rowid = 123)\n)\nlimit 100;\n```\n\nYou can `INSERT` and `DELETE` into these tables as necessary, but [`UPDATE` operations aren't supported yet](https://github.com/asg017/sqlite-vss/issues/7). This can be used with triggers for automatically updated indexes. Also note that \"small\" `INSERT`/`DELETE` operations that only insert a few rows can be slow, so batch where necessary.\n\n```sql\nbegin;\n\ndelete from vss_articles\n  where rowid between 100 and 200;\n\ninsert into vss_articles(rowid, headline_embedding, description_embedding)\n  values (:rowid, :headline_embedding, :description_embedding)\n\ncommit;\n```\n\nYou can pass in custom [Faiss factory strings](https://github.com/facebookresearch/faiss/wiki/The-index-factory) for specific columns to control how the Faiss index is stored and queried. By default the factory string is `\"Flat,IDMap2\"`, which can be slow to query as your database grows. Here, we add an [inverted file index](https://github.com/facebookresearch/faiss/wiki/The-index-factory#inverted-file-indexes) with 4096 centroids, a non-exhaustive option that makes large database queries much faster.\n\n```sql\ncreate virtual table vss_ivf_articles using vss0(\n  headline_embedding(384) factory=\"IVF4096,Flat,IDMap2\",\n  description_embedding(384) factory=\"IVF4096,Flat,IDMap2\"\n);\n```\n\nThis IVF will require training! You can define training data wi","github_created_at":"2023-01-03T23:27:31+00:00","created_at":"2026-07-11T11:33:36.072225+00:00","updated_at":"2026-09-20T06:21:07.112718+00:00","categories":[{"slug":"vector-databases","name":"Vector Databases","url":"https://www.graphcanon.com/categories/vector-databases","markdown_url":"https://www.graphcanon.com/categories/vector-databases.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/vector-databases"}],"tags":[{"slug":"faiss","name":"faiss"},{"slug":"sqlite","name":"sqlite"},{"slug":"sqlite-extension","name":"sqlite-extension"},{"slug":"vector-search","name":"vector-search"}],"trust":{"provenance":{"is_fork":false,"github_id":584946477,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-20T06:21:05.430Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":867,"last_release_at":"2023-08-06T02:26:05Z","stars_delta_30d":2,"open_issues_delta_30d":0},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T11:33:41.340Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-20T06:21:06.471Z"},"languages":{"value":["c++"],"source":"github.language","observed_at":"2026-09-20T06:21:06.471Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-20T06:21:06.471Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["- When you require to perform vector similarity searches within an SQLite environment and want to leverage the performance benefits of Faiss","- If your application runs primarily on an SQLite backend and can benefit from in-database vector search capabilities without needing a separate vector database service"],"when_not_to_use":["- When a standalone, fully managed vector database service that supports additional features beyond Faiss is needed","- In environments where the overhead of integrating a C++ extension into an SQLite database might not be feasible or acceptable"],"source":"enrich:decision_facts","observed_at":"2026-07-17T12:45:34.992Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"sqlite-vss is a specialized SQLite extension that enables efficient vector similarity searches by integrating Faiss functionality into the database operations."}]}}