Linux Kernel in PostgreSQL via pgit
- title
- Linux Kernel in PostgreSQL via pgit
- type
- summary
- summary
- 1.4M kernel commits in PostgreSQL via pgit; contributor bottlenecks, GPU driver churn, SQL-queryable git
- tags
- git, postgresql, linux-kernel, data-analysis
- sources
- linux-kernel-pgit
- created
- 2026-04-09
- updated
- 2026-04-09
Oliver Seifert imported the entire Linux kernel git history โ 1,428,882 commits, 24.4 million file versions, 20 years of development โ into PostgreSQL using pgit, his Go CLI backed by delta-compressed storage. The point isn't to replace git. It's to make git history queryable with SQL, and the article demonstrates this by running a series of analyses that would be painful or impossible with git log alone.
The import
The full kernel imported in about 2 hours on a 24-core Hetzner box with 512 GB RAM. Actual data on disk: 2.7 GB, a 53.5x compression ratio over raw uncompressed git objects. Git's own gc --aggressive compresses better (74.1x, 1.95 GB), but git's pack format isn't queryable โ pgit's is.
The compression comes from pg-xpatch, a PostgreSQL Table Access Method that stores delta-compressed data. Text content (1.3 GB) and commits (600 MB) compress well; file references (the mapping from commits to paths to blobs) take up 2.1 GB and dominate storage.
What SQL reveals about the kernel
The interesting part of the article is the queries. A few highlights:
The committer bottleneck. 38,506 unique authors but only 1,540 committers โ a 25:1 ratio. Three people (David S. Miller, Greg Kroah-Hartman, Linus Torvalds) merged 22.5% of all commits. Miller alone accounts for 7.9%. The kernel's merge hierarchy concentrates enormous trust in a small group.
One-time contributors. 14,000 authors submitted exactly one patch and never came back. That's 36% of all authors. Individual (Gmail) contributions peaked at 12% in 2010 and fell to 8% by 2025 โ the kernel is increasingly corporate.
Small commits dominate. 61.3% of commits touch a single file. 90% touch 5 or fewer. The rare huge commits (up to 53,003 files) are merge commits from subsystem maintainers.
GPU drivers are uniquely messy. The Intel i915 driver appears 8 times in the top 30 file-coupling pairs. GPU drivers (amd/display, amdgpu, i915) account for ~516 reverts โ nearly 10% of all reverts in the kernel. Hardware driver development against moving specs produces churn that other subsystems don't see.
The "buggiest" commit. Linus's initial git import (1da177e4c3f4) has 665 Fixes: references pointing at it, because it's used as shorthand for bugs that existed before git history began.
Kent Overstreet's 13-year bcachefs journey. From initial commit in 2011 through mainline merge in 2023, with 1,194 commits that year alone.
Query performance
All queries ran without materialized views or preprocessing. Most completed in under 3 seconds over 24.4 million file references. The expensive ones were file coupling (48s, requires self-joining the file reference table) and full-text search across all commit messages (44s). Practical for interactive exploration.
Cross-references
- pgit โ the tool itself (toolbox page)
- git-magic-files โ another angle on git's internal machinery
- postgresql โ the database underneath