ENGINEERING 198 upvotes 2018

How We Built a Cost-Based SQL Optimizer

198 pts
Hacker News Signal
2018 · Shared by @andydb
How We Built a Cost-Based SQL Optimizer by @andydb

Retrospective Overview & Key Insights

Distilled reflections, business mechanics, and tactical takeaways:

In this technical retrospective (2018), @andydb shares practical architectural lessons learned from running, scaling, or migrating production software under lean constraints.

Core Principles for Independent Builders:
1
Defaulting to simpler architectures (such as monolithic frameworks, SQLite, or managed VPS) prevents early engineering bankruptcy.
2
Evaluating true compute and egress costs reveals that high cloud bills can often be slashed by 80%+ through judicious re-platforming.
3
Code you write at 2 AM as a solo engineer must be easy to debug six months later without complex microservice dependencies.
Community Debate Themes:

HN engineers debated the tradeoffs between cloud convenience and raw server economics, database indexing strategies, and resisting premature architectural complexity.

Community Discussions & Critical Reviews

Key perspectives, counter-arguments, and peer founder insights debated on Hacker News (52 total discussions):

SH @shoo Peer Contributor
MI @millrawr Peer Contributor
ED @edmundhuber Peer Contributor

Great article, and it sounds like it took a pretty big leap of faith to go from heuristics to cost-based optimization. If this was addressed in the article I apologize: do you only ever select transformations that yield equivalent results, with immediately lower cost, or do you also explore transformations that incur in immediate cost increase, but then later pay off? i.e. are you doing simple hill climbing, or something more interesting?

AT @atombender Peer Contributor

I've been looking for books that cover database implementation techniques such as this — the "memo" algorithm was new to me, but I'm also generally interested in query planning and optimization. Anyone got any recommendations? I started a thread: https://news.ycombinator.com/item?id=18410692 ↗.

HISTORICAL ERA Cloud & Mobile Era (2014–2019)
COMMUNITY SCORE 198 points
TOTAL DISCUSSIONS 52 comments
TOPICS & TECH STACK: