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 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 mysql/mysql-server and postgres/postgres 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-10-31, mysql/mysql-server contains 10,680,705 total lines (7,187,066 code) across 34,708 files, while postgres/postgres contains 2,941,094 total lines (1,637,148 code) across 4,145 files as of 2026-11-16. mysql/mysql-server has about 4.4x the counted code lines of postgres/postgres 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.

Metricmysql/mysql-serverpostgres/postgres
Files34,7084,145
Total lines10,680,7052,941,094
Code lines7,187,0661,637,148
Comment lines2,256,479892,939
Blank lines1,237,160411,007
Languages counted6623

Top languages in mysql/mysql-server: C++ Header (35.8% of code), C++ (33.7% of code), C Header (13.3% of code). Top languages in postgres/postgres: C (59.4% of code), PO File (25.0% of code), C Header (7.3% 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 trunk (commit 06bcb0eb0ad2) on 2026-10-31; postgres/postgres was counted at ref master (commit 7fc2f0423320) 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. mysql/mysql-server: 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. postgres/postgres: 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: mysql/mysql-server is the MySQL server source tree: the SQL layer, storage engines including InnoDB, the mysql-test suite, and client programs. postgres/postgres is 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.

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

As of 2026-10-31, mysql/mysql-server contains 10,680,705 total lines (7,187,066 code) across 34,708 files, while postgres/postgres contains 2,941,094 total lines (1,637,148 code) across 4,145 files as of 2026-11-16. mysql/mysql-server has about 4.4x the counted code lines of postgres/postgres 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 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 trunk (commit 06bcb0eb0ad2) on 2026-10-31; postgres/postgres was counted at ref master (commit 7fc2f0423320) 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.