# 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 with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-08-26, cockroachdb/cockroach contains 4,182,809 total lines (3,085,053 code) across 12,785 files, while yugabyte/yugabyte-db contains 6,551,516 total lines (4,654,940 code) across 17,804 files as of 2026-08-27. yugabyte/yugabyte-db is about 1.5x the size of cockroachdb/cockroach by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [cockroachdb/cockroach](https://octocounts.com/github/cockroachdb/cockroach) | [yugabyte/yugabyte-db](https://octocounts.com/github/yugabyte/yugabyte-db) |
| --- | ---: | ---: |
| Files | 12,785 | 17,804 |
| Total lines | 4,182,809 | 6,551,516 |
| Code lines | 3,085,053 | 4,654,940 |
| Comment lines | 698,670 | 1,134,718 |
| Blank lines | 399,086 | 761,858 |
| Languages counted | 12 | 12 |

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 (26.7% of code), C++ (16.0% of code), SQL (8.4% of code). Go, JSON, YAML, Bazel, TSX appear only in cockroachdb/cockroach's top languages; C, C++, SQL, Java, Rust 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 master (commit 8812064a015d) on 2026-08-26; yugabyte/yugabyte-db was counted at ref master (commit daa8bac23494) on 2026-08-27. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

cockroachdb/cockroach counts the CockroachDB repository — a distributed SQL database implemented as a single large Go codebase. yugabyte/yugabyte-db counts the YugabyteDB repository — a distributed SQL database whose counted tree includes a substantial C++ storage and query layer, including code derived from PostgreSQL. Both counts therefore measure 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)](https://github.com/cockroachdb/cockroach) · [yugabyte/yugabyte-db repository (distributed SQL database)](https://github.com/yugabyte/yugabyte-db). Statements verified 2026-09-16.

Evidence and next steps:

- [cockroachdb/cockroach SLOC report](https://octocounts.com/github/cockroachdb/cockroach)
- [yugabyte/yugabyte-db SLOC report](https://octocounts.com/github/yugabyte/yugabyte-db)
- [Compare cockroachdb/cockroach and yugabyte/yugabyte-db interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fcockroachdb%2Fcockroach&right=https%3A%2F%2Fgithub.com%2Fyugabyte%2Fyugabyte-db)

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?

yugabyte/yugabyte-db has more code: 4,654,940 code lines versus 3,085,053 for cockroachdb/cockroach, about 1.5x as much, based on cached OctoCounts reports as of 2026-08-27.

### 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 master (commit 8812064a015d) on 2026-08-26; yugabyte/yugabyte-db was counted at ref master (commit daa8bac23494) on 2026-08-27. 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.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
