⚠️ Experimental — Breaking Changes Expected

High-Performance
Vector Database
for Go

Native embedding storage with HNSW + DiskANN hybrid indexing, SIMD acceleration, tiered cloud storage, and sub-millisecond search latency.

main.go
// Create index (128 dims, L2 distance)
db, _ := vecgo.Open(ctx, vecgo.Local("./data"), vecgo.Create(128, vecgo.MetricL2))
defer db.Close()

rec := vecgo.NewRecord(embedding).
    WithMetadata("category", metadata.String("tech")).
    WithPayload([]byte(`{"title": "Hello World"}`)).
    Build()
id, _ := db.InsertRecord(ctx, rec)
db.Commit(ctx) // Durable after commit

results, _ := db.Search(ctx, query, 10)
for _, r := range results {
    fmt.Printf("ID: %d, Score: %.4f\n", r.ID, r.Score)
}

Why Vecgo?

The sweet spot between embedded libraries and full database systems

100%
Pure Go — No CGO
70K+
Lines of Code
<1ms
Search Latency

SIMD Acceleration

Runtime-detected AVX-512, AVX2, NEON, and SVE2 for blazing-fast distance calculations.

🔀

Hybrid Indexing

HNSW + DiskANN/Vamana with FreshDiskANN for real-time updates without rebuilding.

📦

Quantization

PQ, OPQ, SQ8, Binary, RaBitQ, and INT4 for 4-32× memory reduction with minimal recall loss.

☁️

Tiered Storage

Hot data in memory, warm on SSD, cold on S3/MinIO with automatic tiering.

⏱️

Time Travel

Query historical snapshots with MVCC-style versioning and point-in-time recovery.

🔍

Hybrid Search

Combine vector similarity with BM25 text search and metadata filtering.

🎯

Distance Functions

Euclidean, Cosine, Inner Product, and Hamming with automatic optimization.

📊

Observability

OpenTelemetry tracing and metrics for production monitoring.

🔒

Commit-Oriented

Append-only versioned commits with atomic segments — no WAL complexity.

Two-Tier Architecture

Vecgo uses an LSM-tree inspired design with HNSW for hot data and DiskANN for cold data, providing optimal performance across all access patterns.

  • L0 (Memory) — HNSW index for real-time insertions and fast reads
  • L1 (Disk) — DiskANN/Vamana graph for billion-scale datasets
  • Compaction — Background merging from L0 → L1 without blocking reads
  • FreshDiskANN — Streaming updates without full index rebuilds
  • Segment-based — Immutable segments with efficient GC
L0: HNSW In-Memory Fast insertions, sub-ms reads, ~100K vectors
L1: DiskANN On-Disk Compacted segments, billions of vectors
Blob Storage: S3 / MinIO / Local Tiered cold storage with caching

Tuning Guide

Optimize for your workload: latency, throughput, or recall

Parameter Default When to Increase When to Decrease
M (HNSW edges) 16 Higher recall needed, larger datasets Memory constrained, small datasets
EfConstruction 200 Build once, query often Faster indexing priority
EfSearch 100 Higher recall (0.99+) Lower latency priority
R (DiskANN degree) 64 Disk-based, high recall Faster build, less disk I/O
L (DiskANN search list) 100 Better recall at query time Minimize SSD reads
PQ.M (subquantizers) dims/4 Better compression vs recall tradeoff Memory less constrained

Operations & Durability

Commit-oriented durability with no WAL complexity — simpler code, fewer moving parts.

  • Commit-Oriented — Append-only versioned commits, no WAL rotation or checkpointing
  • Atomic Segments — Immutable segments with all-or-nothing writes
  • S3 Storage — S3 Express or standard S3 for tiered cold storage
  • DynamoDB Commits — Optional coordination for concurrent S3 writers
  • MinIO Support — Self-hosted S3-compatible storage
  • Block Cache — Configurable cache for hot blob reads

Quick Start

Requires Go 1.24+ (64-bit)

go get github.com/hupe1980/vecgo

License

Apache License 2.0

Free for commercial use, modification, and distribution.

vs Simple Libraries
More capable: durability, MVCC, hybrid search, cloud storage tiering
vs CGO Wrappers
Simpler: pure Go toolchain, static binaries, easy cross-compilation
vs Milvus/Qdrant
Embedded: no cluster to manage, sub-ms latency, single binary deployment

Ready to Build?

Check out the examples and start building with Vecgo today.

View Examples →