The Pragmatic Engineer
The Pragmatic Engineer

Distributed databases with Peter Mattis

Brought to You By: • turbopuffer – a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable • Linear – the product development system for teams and agents • WorkOS – everything you need to make your app enterprise ready. — How is it that a software veter

Featured Speakers

Peter Mattis Guest

Topics Discussed

Episode Summary

Executive Summary: Peter Mattis traces a career from building GIMP and key Google systems (Gmail storage, build tools, Colossus) to co-founding Cockroach Labs, emphasizing B-trees, distributed systems, and strong consistency. He argues AI now amplifies expert engineers, enabling production-ready code at far higher output, but only when paired with rigorous testing, performance awareness, and domain expertise.

Main Topics: Early computing, GIMP, and the power of naïveté (Priority: 5/5): Peter describes discovering computers through childhood exposure and games, switching from mechanical engineering to CS, and building GIMP/GTK in college by tackling a Photoshop-like project without fully appreciating the difficulty. Google years: Gmail, build systems, and Colossus (Priority: 5/5): He explains working on Gmail’s storage/threading/indexing, helping build Google’s internal build system that became Bazel/Buck ideas externally, and joining Colossus to scale distributed storage beyond GFS. B-trees, hash tables, and data-structure-driven performance (Priority: 5/5): A recurring theme is that storage and indexing problems repeatedly lead him to B-trees, later extending to optimized maps and Swiss tables in Go, illustrating how data structures and cache locality shape real systems. CockroachDB: distributed database design and strong consistency (Priority: 5/5): Peter contrasts distributed storage with distributed databases, explaining sharding, replicas, consensus (Raft/Paxos), serializability, and why CockroachDB prioritizes resilience and correctness for mission-critical workloads. AI-assisted coding and the return to high output (Priority: 5/5): After a lower-coding period as an executive, Peter says AI coding tools reignited his hands-on work. He argues models are highly capable but lazy about testing and need strong guidance, guardrails, and expert review. Future of software engineering with AI (Priority: 4/5): He believes AI will write an increasing share of software, especially internal apps, and that strong engineers will be amplified the most. The role of engineers shifts toward orchestration, architecture, and domain expertise.

Key Arguments: B-trees matter because they match cache behavior and sorted-range access patterns in databases better than pointer-heavy trees; Peter repeatedly reinvented them across systems because they solved practical performance problems. Large distributed systems can be made efficient and reliable by combining solid abstractions (e.g., immutable storage, metadata services, consensus) with careful engineering around latency, replication, and bootstrapping. Strong consistency simplifies application development, even though it is harder to implement, because users can read back what they just wrote across replicas without reasoning about stale reads. AI is not just autocomplete: for strong engineers, it can materially accelerate design exploration, implementation, and review, but only if the human enforces testing discipline and performance/security constraints. Most code quality regressions come from insufficient rigor, not from AI itself; advanced testing methods, guardrails, and adversarial review can offset the risk. The best AI users are domain experts: knowledge of databases, storage, performance, and architecture determines whether the model produces magical results or shallow output. Code review will evolve, not disappear immediately; humans will review less of the generated code directly, and AI will increasingly become the first-line reviewer for lower-level verification tasks. The software industry should raise ambition because AI makes higher-quality, faster, more secure output feasible, not because it permits lower standards.

Data Points: Pre-AI code output: ~100,000 lines of code per year - Peter says this was his peak annual output before AI while he was highly active as a coder and CTO. Typical engineer output: ~3,000 lines of code per month - He cites the industry’s rough average to compare against his own pre-AI throughput. Recent rewrite effort: ~40,000–50,000 lines of code - He estimates the size of a CockroachDB-related rewrite he led around 2019. Rapid AI-assisted implementation: ~10,000 lines in 30 minutes - He says he implemented another B-tree in about 30 minutes using AI assistance. Gmail launch date: April 1, 2004 - He recalls Gmail’s launch timing, which reinforced the April Fool’s joke perception. Google join date: April 1, 2002 - He started at Google on April 1, 2002, during the early Gmail era. GFS scale limit: ~1,000 machines per cluster - He describes this as an approximate scalability ceiling that motivated Colossus. Target scale for Colossus: ~10,000 machines - Google wanted the successor distributed file system to scale well beyond GFS. Storage chunk size: 64 megabytes - He mentions Colossus/GFS file chunks being split into 64 MB pieces. Latency on hard-disk-backed object storage: 20–30 milliseconds - He cites this as the first-read latency range for systems like S3/GCS on hard drives. SSD read latency: 30–50 microseconds - He contrasts NVMe/SSD latency with spinning disks to show the hardware gap. Network latency within a zone: ~100 microseconds - He notes modern datacenter interconnects are dramatically faster than older milliseconds-scale links. AI adoption inside company: ~100% of engineers - He says nearly all engineers at Cockroach Labs are now using AI tools to some degree. Internal app creation: 500 to 1,000 applications - He says non-engineers used an internal platform to generate many apps over a couple of months. Team size: ~110 engineers / ~150 R&D total - He gives a rough current headcount estimate for Cockroach Labs.

Pivotal Quotes: "For the last 30 years, I've always been a prolific coder, but my current output is a bit insane." — Peter Mattis: He describes how AI has transformed his coding throughput after years of experience. "I wanted these things, this database, to be unkillable." — Peter Mattis: He explains the origin of the CockroachDB name and its resilience mission. "The agents are lazy." — Peter Mattis: He summarizes his view that AI coding tools need firm guidance, especially on testing and rigor.

Implications: The episode suggests expert engineers who pair deep systems knowledge with AI can multiply output without sacrificing quality. For teams, the winning pattern is rigorous guardrails, testing, and domain expertise—not blind automation.

🔓 Sign Up for Unlimited Episode Search

About The Pragmatic Engineer

View all episodes from The Pragmatic Engineer