I rewrote PostHog's SQL parser, 70x faster, while barely looking at the code

posthog.com
June 24, 2026
9 min read
54/100
Summary
PostHog's SQL parser was rewritten using multiple long-running Claude Code sessions in parallel, resulting in a 70x speed increase. The new parser consists of 16,000 lines of code, 5,000 lines of tooling, and additional test code, maintaining equivalence to the previous parser for all realistic queries.
Key Takeaways
- PostHog developed a new SQL parser that is 70 times faster than the previous version, consisting of 16,000 lines of parser code and 5,000 lines of tooling.
- The new parser maintains equivalent functionality for realistic SQL queries while differing only for a very small subset of edge cases.
- The parser was generated using ANTLR, an open-source parser generator, which allows for easier maintenance compared to hand-written parsers.
- AI-assisted coding was utilized to create the new parser, although it involved multiple iterations and corrections due to initial mistakes.
Coverage & discussions
Hacker News Ā· posthog.com
Community discussions
Historical count: 5 Ā· 5 saved in sample Ā· Historical sample
Analysis ready
Community Sentiment
Positives
- The SQL parser's performance improvement highlights the potential of AI to enhance existing technologies, showcasing how skilled developers can leverage AI tools effectively.
- The discussion around democratization of intelligence suggests that AI can evolve our understanding and creativity, similar to the impact of the internet.
- Using AI as a powerful tool in software development can streamline processes, allowing for more efficient testing and implementation strategies.
Concerns
- Concerns about AI leading to a decline in individual knowledge advancement indicate a fear that reliance on AI may stifle personal growth and learning.
- Skepticism about the originality of AI-generated solutions suggests that many believe existing knowledge and techniques are being overshadowed by AI's capabilities.
Related Articles

How AST-grep Rewrote Tree-sitter in Rust and Made It 30% Faster
Jul 26, 2026

We tasked Opus 4.6 using agent teams to build a C Compiler
Feb 5, 2026

Rust Glancer: Rust LSP using 100x less RAM
Aug 21, 2026

JIT Compiling Code in 5μs
Aug 23, 2026

Migrating a production AI agent to GPT-5.6: 2.2x faster, 27% cheaper
Jul 12, 2026