# Approximate nearest neighbor search with DiskANN in libSQL

DevFeed: [Approximate nearest neighbor search with DiskANN in libSQL](<https://devfeed.tech/articles/approximate-nearest-neighbor-search-with-diskann-in-libsql-5892.md>)

Original publisher: [Read original article](<https://turso.tech/blog/approximate-nearest-neighbor-search-with-diskann-in-libsql>)

Author: Pekka Enberg

Published: 2024-07-26T00:00:00Z

Content type: article

Language: en

Sources: [Turso Blog](<https://devfeed.tech/sources/turso-blog.md>)

Topics: [libSQL](<https://devfeed.tech/topics/libsql.md>), [ann](<https://devfeed.tech/topics/ann.md>), [SQLite](<https://devfeed.tech/topics/sqlite.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Retrieval Augmented Generation (RAG)](<https://devfeed.tech/topics/retrieval-augmented-generation-rag.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [ann](<https://devfeed.tech/tags/ann.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [libsql](<https://devfeed.tech/tags/libsql.md>), [performance](<https://devfeed.tech/tags/performance.md>), [rag](<https://devfeed.tech/tags/rag.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sqlite](<https://devfeed.tech/tags/sqlite.md>), [vector](<https://devfeed.tech/tags/vector.md>), [vector-search](<https://devfeed.tech/tags/vector-search.md>)

## AI overview

This article explains how libSQL implements approximate nearest neighbor search for large embedding datasets using the low-memory LM-DiskANN algorithm. It describes the trade-off between exactness and speed, graph-based search, vector indexing in SQLite, cosine distance, and the integration between SQLite's code generator and the DiskANN index.

## Source excerpt

Learn how to use retrieval augmented generation to improve vector search results with SQLite.