Open-Source Wikis

/

CockroachDB

/

By the numbers

cockroachdb/cockroach

By the numbers

A quantitative snapshot of the CockroachDB monorepo. Data collected on 2026-04-30 against commit 7ede7041c6 on master.

Size

Language / category Files Lines
Go (under pkg/) 9,133 ~3.58M
Go tests (*_test.go under pkg/) 3,102 (subset of above)
TypeScript / TSX (DB Console under pkg/ui/) 987 ~118K
Protobuf (.proto, repo-wide) 179 ~41K
C / C++ (c-deps/) many embedded vendor code
xychart-beta horizontal
  title "Source LOC by language (thousands)"
  x-axis [Go, TypeScript, Protobuf]
  y-axis "Lines (000s)" 0 --> 4000
  bar [3583, 118, 41]

The Go base is dominant. The TypeScript codebase under pkg/ui/ is the DB Console SPA. Protobuf is widely used: every wire type in roachpb, kvserverpb, serverpb, jobspb, enginepb, execinfrapb, and many more is defined in .proto.

Largest Go subtrees by file count

Subtree Go files
pkg/sql/ ~3,300 (incl. tests, generated, opt rules)
pkg/kv/kvserver/ ~600+
pkg/cmd/ ~1,000+ (every dev binary lives here)
pkg/util/ (~115 sub-packages) ~700+
pkg/server/ ~250
pkg/storage/ ~120

Notable individually large files

File Approx. size
pkg/storage/mvcc.go ~340 KB
pkg/kv/kvserver/replica_test.go ~520 KB
pkg/kv/kvserver/replica.go ~125 KB
pkg/kv/kvserver/store.go ~180 KB
pkg/kv/kvserver/replica_command.go ~175 KB
pkg/kv/kvserver/replica_raft.go ~135 KB
pkg/server/status.go ~155 KB
pkg/server/server_sql.go ~85 KB
pkg/sql/vars.go ~210 KB
pkg/sql/exec_util.go ~150 KB
pkg/raft/raft.go ~115 KB
DEPS.bzl ~580 KB (vendored dep manifest)

Activity

CockroachDB's first commit landed on 2014-02-05. The master branch has accumulated about 117,683 commits since then.

xychart-beta horizontal
  title "Commits per year on master"
  x-axis [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026]
  y-axis "Commits" 0 --> 13000
  bar [1344, 5848, 9697, 9142, 10477, 8020, 10685, 10958, 11480, 12488, 11380, 11254, 4910]

(The 2026 column is partial — it only reaches 2026-04-30.)

The volume is roughly steady at 10,000–12,000 commits/year since 2018. The master branch is shared across many active release trains: at the time of capture, v26.2.0-rc.1 is the most recent tag, with v26.1.x, v25.4.x, and a long tail of older patches still receiving backports.

Bot-attributed commits

About 28,598 of the 117,682 commits (~24%) carry an automated author or co-author. The CockroachDB workflow generates many such commits:

  • craig[bot] is the merge bot — most regular PRs are landed under its name on master.
  • cockroach-teamcity and other CI bots backport commits and update generated files.
  • dependabot[bot] and renovate[bot] update dependencies.

This number is a lower bound on automated activity (it does not capture commits whose body lists a bot in Co-authored-by: only) but a wild upper bound on AI-assisted authorship — most bot commits in this repo are Bors-style merges, not generative tooling.

Complexity hotspots

The kvserver is the biggest single hotspot: the Replica and Store types together account for over a thousand methods spread across dozens of files. The SQL layer is the largest by file count, but is more uniformly distributed (every DDL statement gets its own alter_*.go, drop_*.go, etc.).

Optimizer rules and SQL parsing rely heavily on generation. The .opt files under pkg/sql/opt/norm/rules/ and pkg/sql/opt/xform/rules/ define declarative rewrite rules that compile into Go code via optgen. The SQL grammar lives in pkg/sql/parser/sql.y and is fed through goyacc.

Dependencies

go.mod is ~28 KB and go.sum is ~336 KB; DEPS.bzl is ~580 KB and is the source of truth for Bazel. Notable in-tree forks live as separate Go modules: pkg/raft/ (the etcd/raft fork) and an embedded GEOS in c-deps/.

Contributors

Git history attributes commits to 1,047 unique authors. The contributor base is dominated by Cockroach Labs engineers but includes many community contributors; see EXTERNAL-CONTRIBUTORS-HALL-OF-FAME.md for an external-contributor roll, and AUTHORS for a flat author list. Per-person stats are intentionally omitted — see maintainers.md for ownership.

Releases

CockroachDB ships two majors per year: each release line follows vXX.1 (Spring) and vXX.2 (Fall) cadence with periodic patch releases. Recent tags include v25.4.x, v26.1.x, and the in-progress v26.2.0. See pkg/build/version.txt and pkg/clusterversion/cockroach_versions.go for the build-vs-cluster-version split.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

By the numbers – CockroachDB wiki | Factory