v.22.9Experimental Feature

Add ANN Index Using Annoy to ClickHouse

Add ANN (approximate nearest neighbor) index based on Annoy. #40818 (Filatenkov Artur). #37215 (VVMak).
Introduces a new ANN (Approximate Nearest Neighbor) index in ClickHouse based on the Annoy library for efficient similarity search.

Why it matters

This feature enables fast approximate nearest neighbor search capabilities in ClickHouse, solving the problem of slow similarity queries on high-dimensional data. It provides significant performance improvements for applications like recommendation systems, search engines, and machine learning workloads.

How to use it

Create a table with the ANN index by specifying the index type as annoy. Use the new index to speed up nearest neighbor queries on vector data. For example, define the index as follows:

CREATE TABLE table_name (
vector_column Array(Float32),
INDEX ann_index_name vector_column TYPE annoy GRANULARITY 64
) ENGINE = MergeTree()


Queries using this index will automatically leverage the ANN search capabilities.