Open-Source Wikis

/

TiDB

/

By the numbers

pingcap/tidb

By the numbers

Data collected on 2026-04-30 from the local clone at master (9d1ac814ec).

Size

  • Total commits: 28,006.
  • Unique authors (raw, includes bots): 1,058.
  • First commit: 2015-09-06 ("Add files"). The repo is roughly 10½ years old.
  • Most recent commit (HEAD): 2026-04-30sysvar: add tidb_enable_strict_not_null_check (#68109).
  • Total Go files (excluding tests): 3,996.
  • Total Go test files: 1,758.
  • Total Go files including tests (under pkg/cmd/br/dumpling/lightning): roughly 28,000 files when generated code is included; the source-only count above is the tighter figure.

Disk size by top-level area

xychart-beta horizontal
  title "Disk usage by top-level directory (MB)"
  x-axis [pkg, tests, br, lightning, dumpling, cmd]
  y-axis "MB" 0 --> 100
  bar [91, 27, 7.2, 5.7, 1.1, 0.4]

pkg/ carries 91 MB on its own — most of the SQL implementation lives there. tests/ is the second-largest at 27 MB because of the realtikvtest and integrationtest golden files.

Activity

  • Commits in the last 90 days: 489.

  • Recent (last 90 days) most active human contributors:

    Author Commits (90d)
    Weizhen Wang 65
    D3Hunter 53
    Dongpo Liu 27
    tpp 24
    Yuanjia Zhang 22
    Arenatlx 17
    Yiding Cui 16
    Rossi Sun 16
    guo-shaoge 12
    GMHDBJD 12
  • All-time top committers (raw counts, includes bots):

    Author Commits (all)
    Ti Chi Robot 4,089
    ti-srebot 2,020
    Weizhen Wang 1,819
    tiancaiamao 1,663
    Ewan Chou 1,097
    Yuanjia Zhang 1,084
    crazycs 849
    pingcap-github-bot 808
    Lynn 701
    tangenta 662

    The first two and the eighth row are bots that perform cherry-picks and lint sweeps on behalf of human contributors.

Bot-attributed commits

This is a lower bound — it only counts commits whose body contains an explicit Co-authored-by: …[bot] trailer.

  • Co-authored-by: of any kind: 565 commits (out of 28,006 ≈ 2.0 %).
  • Of those, [bot] co-authors: 0 detected.

The dominant pattern in this repo is bot commit authors (Ti Chi Robot, ti-srebot, pingcap-github-bot) rather than co-authored trailers. Around 6,917 of all commits are authored by one of those three bot accounts (≈ 25 %), nearly all of them automated cherry-picks of human-authored merges into release branches. AI-assisted authoring (Copilot, Cursor, etc.) is invisible in git history, so the real ratio of human-vs-tool contribution is impossible to derive from this repo alone.

Complexity hotspots

The top hand-written non-test files by size, excluding generated artefacts:

Lines (bytes) File
295 KB pkg/planner/core/logical_plan_builder.go
253 KB pkg/planner/core/planbuilder.go
251 KB pkg/ddl/executor.go
241 KB pkg/expression/builtin_time.go
213 KB pkg/executor/builder.go
197 KB pkg/session/session.go
191 KB pkg/ddl/partition.go
164 KB pkg/infoschema/metric_table_def.go
162 KB pkg/infoschema/tables.go
137 KB pkg/executor/infoschema_reader.go

The single biggest file in the tree, pkg/parser/parser.go at 7.95 MB, is generated from pkg/parser/parser.y. Don't be alarmed by it; do not edit it.

The UCA collation tables (pkg/util/collate/ucadata/unicode_0900_ai_ci_data_generated.go at 2.16 MB and friends) and the vectorized expression generators (pkg/expression/builtin_time_vec_generated_test.go at 631 KB) are also generated and should be regenerated rather than edited.

TODO / FIXME / HACK

  • Total occurrences in pkg/: 2,361 comments containing TODO, FIXME, or HACK.

That works out to roughly one such marker per 13 source files. Treat it as routine "things to come back to" rather than a blocker pile — many are referenced from open issues.

Test-to-code ratio

Out of all files in pkg/, cmd/, br/, dumpling/, lightning/:

  • Source files (*.go excluding *_test.go): 3,996.
  • Test files (*_test.go): 1,758.
  • Ratio: roughly 0.44 test files per source file.

That ratio underestimates test density because many test files are very large (golden integration tests in pkg/planner/core/casetest/, pkg/expression/typeinfer_test.go at 305 KB, etc.). A bytes-weighted ratio would be closer to 1:1.

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

By the numbers – TiDB wiki | Factory