Issue: Date: 2026-01-30T16:24:20-08:00


Summary

Yes, DuckDB does support HNSW (Hierarchical Navigable Small World) indexes through its Vector Similarity Search (VSS) extension. HNSW is the primary index type provided by this experimental extension for accelerating vector similarity search queries.

Key Findings

HNSW Index Support

  • DuckDB’s vss extension (experimental) provides full support for HNSW indexes
  • HNSW is implemented based on the usearch library, a flexible C++ implementation
  • Indexes are created using the standard CREATE INDEX statement with USING HNSW clause

Syntax Example

CREATE TABLE embeddings (vec FLOAT[3]);
CREATE INDEX idx ON embeddings USING HNSW (vec) WITH (metric = 'cosine');

Supported Distance Metrics

  • l2sq (Euclidean distance squared)
  • cosine (Cosine similarity)
  • inner_product (Inner product)

Important Capabilities

  • Supports INSERT, UPDATE, and DELETE operations after index creation
  • Multiple HNSW indexes can be created on the same table (different columns or metrics)
  • Index updates automatically when underlying data changes

Critical Limitations

  • Vector type: Only 32-bit FLOAT vectors are supported (use FLOAT[n] type)
  • Memory requirement: Indexes are not buffer-managed and must fit entirely in RAM
  • Index memory does NOT count toward DuckDB’s memory_limit configuration
  • Most efficient when index is created over already-populated tables (rather than inserting after index creation)

Recommendation

If you’re looking to implement vector similarity search in DuckDB, the VSS extension with HNSW indexes is the native solution. Just ensure your vector data uses 32-bit floats and you have sufficient RAM for the index size.


Sources