---
title: "How CockroachDB Built Vector Indexing at Scale"
url: https://daily.dev/posts/how-cockroachdb-built-vector-indexing-at-scale-ctsjj6qg0
source_url: https://blog.bytebytego.com/p/how-cockroachdb-built-vector-indexing
type: article
source: "ByteByteGo"
published: 2026-05-25T15:32:57.550Z
updated: 2026-05-25T15:33:24.591Z
tags: ["vector-search", "cockroachdb"]
reading_time: 13
upvotes: 61
comments: 2
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How CockroachDB Built Vector Indexing at Scale

**[ByteByteGo](https://daily.dev/sources/bytebytego)** · 13 min read · 61 upvotes · 2 comments

## Summary

CockroachDB's engineering team built C-SPANN, a novel vector index designed to satisfy six strict architectural constraints of a distributed SQL database: no central coordinator, no large in-memory caches, minimal network hops, sharding compatibility, no hot spots, and real-time incremental updates. C-SPANN combines ideas from Microsoft's SPANN, SPFresh, and Google's ScaNN, using a hierarchical K-means tree stored as ordinary key-value table data inside CockroachDB. This design lets the index inherit existing distributed machinery — range splitting, rebalancing, replication — for free. Vectors are compressed using RaBitQ (94% size reduction) with a reranking step to recover accuracy. Multi-tenancy is handled via prefix columns, maintaining separate K-means trees per user and supporting geo-partitioning. The tradeoff: C-SPANN loses on raw latency vs. specialized in-memory vector databases but wins on transactional consistency, multi-tenant isolation, and multi-region deployment.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.bytebytego.com/p/how-cockroachdb-built-vector-indexing>

## Community discussion

Top comments from developers on daily.dev.

**@deepjoshi\_dev** · 2 upvotes

> Name is a bit freaky though.

## Similar posts on daily.dev

- [AlloyDB ScaNN index four-level tree improves vector search](https://daily.dev/posts/alloydb-scann-index-four-level-tree-improves-vector-search-y3mlioddc) · Google Cloud · 0 upvotes · 0 comments
- [Decoupled by Design: Billion-Scale Vector Search](https://daily.dev/posts/decoupled-by-design-billion-scale-vector-search-puyxn3eah) · databricks · 26 upvotes · 0 comments
- [The story of BigQuery vector search](https://daily.dev/posts/the-story-of-bigquery-vector-search-tmmmlqwoo) · Google Cloud · 1 upvotes · 0 comments

---

Tags: [#vector-search](https://daily.dev/tags/vector-search), [#cockroachdb](https://daily.dev/tags/cockroachdb)

[View this post on daily.dev](https://daily.dev/posts/how-cockroachdb-built-vector-indexing-at-scale-ctsjj6qg0)
