Skip to main content
Vector search is a libSQL feature. See the libSQL vector search documentation.

Vector functions

A vector can have at most 65536 dimensions. A distance between vectors of different types or lengths is rejected with an error rather than returning a wrong number.

Vector indexes

Declare a vector column with a type that includes its dimension, then create an index on it with libsql_vector_idx(). Query the index with vector_top_k():

Column types

The column types are F32_BLOB(n), F64_BLOB(n), F16_BLOB(n), FB16_BLOB(n), F8_BLOB(n), and F1BIT_BLOB(n), where n is the number of dimensions. A column without a dimension, or a plain BLOB, cannot be indexed. Inserting a value with the wrong dimension, or a non-vector value, is rejected.

Index options

The index options are metric=cosine (default) or metric=l2, plus the tuning options type=diskann, compress_neighbors, max_neighbors, search_l, and insert_l. INSERT, UPDATE, and DELETE maintain the index automatically.

Querying

k must be 1 or greater. A k larger than the row count returns every row, and an empty index returns no rows. A query vector whose type or dimension does not match the index is rejected.
Last modified on November 2, 2026