CockroachDB vs YugabyteDB: source lines of code compared

The CockroachDB vs YugabyteDB comparison on OctoCounts shows side-by-side source line counts for cockroachdb/cockroach and yugabyte/yugabyte-db, counted under the rules and on the dates stated below: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

This page compares the source lines of code (SLOC) of cockroachdb/cockroach and yugabyte/yugabyte-db using cached OctoCounts reports. Code size is not code quality: a larger count only means more source material, not a better or worse project.

As of 2026-11-09, cockroachdb/cockroach contains 4,182,809 total lines (3,085,053 code) across 12,785 files, while yugabyte/yugabyte-db contains 6,873,300 total lines (4,911,413 code) across 18,436 files as of 2026-11-16. yugabyte/yugabyte-db has about 1.6x the counted code lines of cockroachdb/cockroach under the same engine and counting rules. Code size is not code quality: a larger count only means more source material, not a better or worse project.

Metriccockroachdb/cockroachyugabyte/yugabyte-db
Files12,78518,436
Total lines4,182,8096,873,300
Code lines3,085,0534,911,413
Comment lines698,6701,174,019
Blank lines399,086787,868
Languages counted4057

Top languages in cockroachdb/cockroach: Go (84.1% of code), JSON (4.0% of code), YAML (3.3% of code). Top languages in yugabyte/yugabyte-db: C (25.6% of code), C++ (16.8% of code), Rust (8.2% of code). Go, JSON, YAML, Bazel, TSX appear only in cockroachdb/cockroach's top languages; C, C++, Rust, SQL, Java appear only in yugabyte/yugabyte-db's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. cockroachdb/cockroach was counted at ref 8812064a015d2faf99d3fc7e15880f94042954b0 (commit 8812064a015d) on 2026-11-09; yugabyte/yugabyte-db was counted at ref master (commit 9a99c69c01b0) on 2026-11-16. See the counting methodology for ignored directories and analysis options.

Both reports use the same engine and effective counting rules. Repository declarations, when enabled, are specific to each repository. cockroachdb/cockroach: tokei-15.0.0, policy directories-v1; docs excluded, tests excluded, generated excluded. Excluded directory names: .cache, .generated, .git, .next, __tests__, build, dist, doc, docs, documentation, fixtures, gen, generated, node_modules, target, test, tests, vendor. Ignored languages: none. Repository declarations: off. Exclusions are rule-based; they do not prove that every test, document or generated file was removed. yugabyte/yugabyte-db: tokei-15.0.0, policy directories-v1; docs excluded, tests excluded, generated excluded. Excluded directory names: .cache, .generated, .git, .next, __tests__, build, dist, doc, docs, documentation, fixtures, gen, generated, node_modules, target, test, tests, vendor. Ignored languages: none. Repository declarations: off. Exclusions are rule-based; they do not prove that every test, document or generated file was removed.

About this comparison

Background observations recorded on 2026-09-16; language descriptions here are historical context, not claims about the current filtered shares. Use this page's measured language breakdown for current counts. Repository layout before counting filters: cockroachdb/cockroach is the CockroachDB repository — a distributed SQL database implemented as a single large Go codebase. yugabyte/yugabyte-db is the YugabyteDB repository — a distributed SQL database whose counted tree includes a substantial C++ storage and query layer, including code derived from PostgreSQL. Both repositories are distributed database source trees, but implemented in different languages with different inherited codebases.

The per-language tables carry the headline contrast: CockroachDB's counted tree is predominantly Go, while YugabyteDB's counted tree is predominantly C++ — two implementations of the same database category in different systems languages, visible without any inference from totals.

YugabyteDB's total includes PostgreSQL-derived query-layer code as part of its counted archive, while CockroachDB implements its SQL layer in its own tree, so the counts reflect different code provenance as well as different sizes.

Source-tree size does not measure database throughput, consistency behavior, or operational cost: those are properties of the running system and its deployment, not of how many lines the repository contains.

Sources: cockroachdb/cockroach repository (distributed SQL database) · yugabyte/yugabyte-db repository (distributed SQL database). Statements verified 2026-09-16.

Evidence and next steps:

Saved reports remain subject to cache cleanup and replacement. Export their JSON for durable citation; live report URLs can change.

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

Compare FAQ

Which has more lines of code, cockroachdb/cockroach or yugabyte/yugabyte-db?

As of 2026-11-09, cockroachdb/cockroach contains 4,182,809 total lines (3,085,053 code) across 12,785 files, while yugabyte/yugabyte-db contains 6,873,300 total lines (4,911,413 code) across 18,436 files as of 2026-11-16. yugabyte/yugabyte-db has about 1.6x the counted code lines of cockroachdb/cockroach under the same engine and counting rules. Code size is not code quality: a larger count only means more source material, not a better or worse project.

Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for cockroachdb/cockroach, yugabyte/yugabyte-db, or any repository.

How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. cockroachdb/cockroach was counted at ref 8812064a015d2faf99d3fc7e15880f94042954b0 (commit 8812064a015d) on 2026-11-09; yugabyte/yugabyte-db was counted at ref master (commit 9a99c69c01b0) on 2026-11-16. See the counting methodology for ignored directories and analysis options.

Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.