# MySQL vs PostgreSQL: source lines of code compared

The MySQL vs PostgreSQL comparison on OctoCounts shows side-by-side source line counts for mysql/mysql-server and postgres/postgres, 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-09-15, mysql/mysql-server contains 10,066,993 total lines (6,793,549 code) across 31,862 files, while postgres/postgres contains 3,205,371 total lines (1,817,922 code) across 5,354 files as of 2026-09-21. mysql/mysql-server is about 3.7x the size of postgres/postgres by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [mysql/mysql-server](https://octocounts.com/github/mysql/mysql-server) | [postgres/postgres](https://octocounts.com/github/postgres/postgres) |
| --- | ---: | ---: |
| Files | 31,862 | 5,354 |
| Total lines | 10,066,993 | 3,205,371 |
| Code lines | 6,793,549 | 1,817,922 |
| Comment lines | 2,119,173 | 931,501 |
| Blank lines | 1,154,271 | 455,948 |
| Languages counted | 12 | 12 |

Top languages in mysql/mysql-server: C++ Header (34.9% of code), C++ (34.0% of code), C Header (13.0% of code). Top languages in postgres/postgres: C (55.2% of code), PO File (22.5% of code), SQL (7.5% of code). C Header, C appear in both top language lists; C++ Header, C++, Bitbake appear only in mysql/mysql-server's top languages; PO File, SQL, Perl appear only in postgres/postgres's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. mysql/mysql-server was counted at ref 6f6b3ca1b7700b9f0fac936a5eb7ff71fa308054 (commit 6f6b3ca1b770) on 2026-09-15; postgres/postgres was counted at ref master (commit 9e17d25e79d4) on 2026-09-21. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

mysql/mysql-server counts the MySQL server source tree: the SQL layer, storage engines including InnoDB, the mysql-test suite, and client programs. postgres/postgres counts the PostgreSQL source tree: the backend, its extensible type and index machinery, regression tests, and documentation sources. Both are full relational-database server codebases, counted on the dates in the methodology line, which makes this one of the more like-for-like comparisons on the site.

Both trees are predominantly C-family systems code — MySQL's counted code is largely C++ while PostgreSQL's is C — as the per-language tables show, reflecting two long-lived server codebases written in different eras' dominant systems languages.

Each counted tree includes a large verification corpus alongside the server itself — MySQL's mysql-test suite and PostgreSQL's regression tests and documentation sources — so a meaningful share of both counts exists to keep the servers correct and documented.

_Server source size does not measure query performance, feature completeness, or operational suitability for a workload; these counts describe maintenance surface and test infrastructure, not runtime behavior._

Sources: [mysql/mysql-server repository](https://github.com/mysql/mysql-server) · [postgres/postgres repository](https://github.com/postgres/postgres). Statements verified 2026-09-16.

Evidence and next steps:

- [mysql/mysql-server SLOC report](https://octocounts.com/github/mysql/mysql-server)
- [postgres/postgres SLOC report](https://octocounts.com/github/postgres/postgres)
- [Compare mysql/mysql-server and postgres/postgres interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fmysql%2Fmysql-server&right=https%3A%2F%2Fgithub.com%2Fpostgres%2Fpostgres)

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, mysql/mysql-server or postgres/postgres?

mysql/mysql-server has more code: 6,793,549 code lines versus 1,817,922 for postgres/postgres, about 3.7x as much, based on cached OctoCounts reports as of 2026-09-21.

### 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 mysql/mysql-server, postgres/postgres, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. mysql/mysql-server was counted at ref 6f6b3ca1b7700b9f0fac936a5eb7ff71fa308054 (commit 6f6b3ca1b770) on 2026-09-15; postgres/postgres was counted at ref master (commit 9e17d25e79d4) on 2026-09-21. 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)
