BotBeat
...
← Back

> ▌

AnthropicAnthropic
RESEARCHAnthropic2026-07-16

PostgreSQL Rewritten in Rust Using Claude: From Four Failed Attempts to 1.8M Lines of Code

Key Takeaways

  • ▸Large language models can orchestrate complete database system rewrites at scale, with Claude successfully handling 1.8M lines of code across thousands of functions and subsystems
  • ▸File-by-file porting outperformed feature-by-feature porting, maintaining architectural coherence and reducing cascade failures across the codebase
  • ▸Rust as a target language provides critical advantages over C for AI-assisted rewrites due to stricter compile-time safety checks that catch model errors automatically
Source:
Hacker Newshttps://malisper.me/how-pgrust-was-built-four-attempts-to-rewrite-postgres-in-rust-with-ai/↗

Summary

After three months and $100k in computational costs, developers brilee and Jason Seibel have successfully rewritten PostgreSQL in Rust using Claude Opus, producing 1.8M lines of idiomatic Rust code. The project went through four failed attempts before discovering a repeatable methodology: a file-by-file porting strategy paired with up to 40 concurrent Claude subagents running in parallel. The first attempt, pgrust-og, failed due to feature-by-feature porting leading to architectural inconsistencies; subsequent iterations refined the approach until achieving a working system.

The breakthrough revealed that Rust's safety properties make it significantly easier for AI models to add features correctly compared to C, the language PostgreSQL is written in. Early versions of pgrust already demonstrate promising performance characteristics: the system is faster than PostgreSQL for transactional workloads and matches Clickhouse's speed for analytical queries—where Clickhouse is typically hundreds of times faster than vanilla PostgreSQL. The developers describe this work as a methodology proof-of-concept for how to approach large-scale legacy system modernization using contemporary AI models, providing a blueprint for other infrastructure rewrites.

  • Concurrent subagent architecture—running 40 Claude agents in parallel—is essential for making months-long rewrites economically feasible

Editorial Opinion

This is a watershed moment for AI-assisted infrastructure modernization. Claude's ability to maintain consistency across 1.8M lines of code and the viability of the file-by-file methodology suggest that large-scale legacy system rewrites are no longer purely human endeavors. If pgrust achieves production parity with PostgreSQL while maintaining code safety and performance, it could reshape enterprise approaches to modernizing mission-critical infrastructure—turning a process typically requiring years and large teams into an AI-augmented effort measured in months.

Large Language Models (LLMs)Generative AIAI AgentsOpen Source

More from Anthropic

AnthropicAnthropic
POLICY & REGULATION

Copyright Law Becomes Key Hurdle for AI Investment in Australia

2026-07-16
AnthropicAnthropic
RESEARCH

AI-Generated UI Is Inaccessible by Default — Industry Analysis Reveals Semantic Deficits Across Code Generation Tools

2026-07-16
AnthropicAnthropic
POLICY & REGULATION

Anthropic Faces EU Backlash Over Junior Staffer Testimony on AI Safety

2026-07-16

Comments

Suggested

IntelIntel
PRODUCT LAUNCH

NameIntel Launches Brand-Scoring Service for AI Agents via MCP

2026-07-16
Moonshot AI (Kimi)Moonshot AI (Kimi)
PRODUCT LAUNCH

Chinese AI Startup Moonshot to Launch Model Challenging Anthropic's Lead

2026-07-16
Epoch AIEpoch AI
INDUSTRY REPORT

Open-Weight AI Models Lag Closed-Weight Frontier by Four Months, Analysis Shows

2026-07-16
← Back to news
© 2026 BotBeat
AboutPrivacy PolicyTerms of ServiceContact Us