Top all-time · #1541
EXPLAIN EXTENDED
Personal blog · explainextended.com · on HN as quassnoiprogrammingdata
EXPLAIN EXTENDED is a personal blog at explainextended.com about programming and data. Since 2009, 46 different Hacker News readers have linked it 54 times, most often “GPT in 500 Lines of SQL”. It is still writing: the last post was on 2025-12-31, and you can follow it by feed.
Too few sampled comments (15) to say how often HN recommends it.?
Why HN links it
HN readers link EXPLAIN EXTENDED for deep SQL write-ups and clever database puzzles and visualisations, such as the Sultan's Riddle, Postgres snowflakes, and adjacency list vs nested sets across several databases.
- Recommended for · 4 comments
- 'Full of jewels'; a 'loved' Postgres snowflakes post; a 'most fun' puzzle; 'knows his database internals'.
Summarised by Claude from a sample of 15 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
How to create fast database queries
Most-linked posts?
- GPT in 500 Lines of SQL10 people · 11 mentions · first linked 2024-01-01
- Solving the Impossible Puzzle with PostgreSQL3 people · 3 mentions · first linked 2017-01-02
- Drawing a snowflake in PostgreSQL3 people · 3 mentions · first linked 2013-01-10
- A GIF decoder in SQL2 people · 2 mentions · first linked 2019-01-03
- Finding the best starting word for Wordle using SQL2 people · 2 mentions · first linked 2022-01-28
- /2009/09/29/adjacency-list-vs-nested-sets-mysql/2 people · 2 mentions · first linked 2011-01-28
- PostgreSQL 8.4: sampling random rows2 people · 2 mentions · first linked 2010-05-30
- Drawing fractals with PostgreSQL2 people · 2 mentions · first linked 2014-01-02
What Hacker News says?
"It's full of jewels", as someone almost said. E.g. The Sultan’s Riddle in SQL https://explainextended.com/2016/12/31/happy-new-year-8/
Comment linking /2016/12/31/happy-new-year-8/
on “GPT in 500 Lines of SQL”Submitted GPT in 500 Lines of SQL as a story · 1111 points
HN discussionOk here is the search that first brought this issue to my attention: mysql spatial index example lft rgt I see the following order: 1: http://planet.mysql.com/entry/?id=23512 2: http://efreedom.com/Question/1-1743894/Mysql-Optimizing-Find... 3: http://explainextended.com/2009/09/29/adjacency-list-vs-nest... 4: http://stackoverflow.com/questions/1743894/mysql-optimizing-...
Comment linking /2009/09/29/adjacency-list-vs-nested-sets-mysql/
on “Google algorithm change launched”Submitted Awesome SQL blog as a story · 155 points
HN discussionI always loved Snowflakes[0] in postgresql. That said though, almost anything could be visualized in postgresql because of the awesome geometric[1] functions that are natively supported. Someday when I'm bored, I might try doing something like the Mona Lisa in postgres. [0] http://explainextended.com/2013/12/31/happy-new-year-5/ [1] http://www.postgresql.org/docs/9.0/static/functions-geometry...
Comment linking /2013/12/31/happy-new-year-5/
on “Woah that is some wild postgresql”Submitted Implementing a quantum computer emulator in SQL as a story · 70 points
HN discussionThings like late row lookups in mysql that are not an issue in postgres https://explainextended.com/2011/02/11/late-row-lookups-inno...
Comment linking /2011/02/11/late-row-lookups-innodb/
on “ZetaSQL – A SQL Analyzer Framework from Google”Submitted Build a new year clock with an SQL query? Sure, why not as a story · 69 points
HN discussionWith Postgres you can also generate fireworks http://explainextended.com/2009/12/31/happy-new-year/ or snowflakes: http://explainextended.com/2011/12/31/happy-new-year-3/ Or you can solve a Sudoku riddle in Oracle https://technology.amis.nl/2009/10/13/oracle-rdbms-11gr2-sol...
Comment linking /2011/12/31/happy-new-year-3/
on “SQLite: Outlandish Recursive Query Examples”Submitted Drawing fractals with PostgreSQL as a story · 51 points
HN discussionOoohh, I didn't know this name for it, thanks. I somehow came across it as The Sultan's Riddle on the internet: https://explainextended.com/2016/12/31/happy-new-year-8/ I prefer this less sterile framing of it. It was the most fun that I ever had with a puzzle, so to anyone scrolling around on this page, I would recommend not jumping straight to the solution :)
Comment linking /2016/12/31/happy-new-year-8/
on ““I don't know the numbers”: a math puzzle”Submitted Things SQL needs: MERGE JOIN that would seek as a story · 28 points
HN discussionI like this style better than SQL for Smarties. Celko tries to stick with the ANSI standard, which is fine, but I much to prefer to know how to get the most out of each platform. Like here, http://explainextended.com/2009/09/ , he covers adjacency list vs. nested sets on MySQL, Postgres, Oracle and SQL Server. Different platforms, different optimal solutions. The man knows his database internals.
Comment linking /2009/09/
on “Awesome SQL blog”Submitted Xkcd comics which can illustrate programming questions as a story · 27 points
HN discussion> I was AMAZED how poorly Oracle performed in one certain use case (real time aggregation of a relatively large hierarchial database) Out of interest, what kind of hierarchial database was this? Something like this? http://explainextended.com/2009/09/28/adjacency-list-vs-nest...
Comment linking /2009/09/28/adjacency-list-vs-nested-sets-oracle/
on “NoSQL vs. RDBMS: Let the flames begin”Submitted Things in MySQL that won't work as expected as a story · 25 points
HN discussionhttps://explainextended.com/2023/12/31/happy-new-year-15/
Comment linking /2023/12/31/happy-new-year-15/
on “Beyond Quacking: Deep Integration of Language Models and RAG into DuckDB”Submitted GPT in 500 Lines of SQL as a story · 9 points
HN discussionThe creators understand it well. The math is pretty a lot, but, you can literally do it with pen and paper. There are plenty of blog[1] posts showing the process. Anyone claiming AI is a black box no one understands is a marketing-level drone trying to sell something that THEY don't understand. [1] https://explainextended.com/2023/12/31/happy-new-year-15/
Comment linking /2023/12/31/happy-new-year-15/
on “Claude Code feels like magic because it is iterative”Submitted Implementing a quantum computer emulator in SQL as a story · 8 points
HN discussionI believe I read that in Postgres the query planner does the same thing whether you use EXISTS/NOT EXISTS or IN/NOT IN. I don't think this is true, unless it's a very recent change. Here's a post from 2009 comparing NOT IN/NOT EXISTS/LEFT JOIN WHERE IS NULL for Postgres: http://explainextended.com/2009/09/16/not-in-vs-not-exists-v...
Comment linking /2009/09/16/not-in-vs-not-exists-vs-left-join-is-null-postgresql/
on “Learn SQL, dammit”Submitted PostgreSQL 8.4: sampling random rows as a story · 8 points
HN discussionYou can actually do really fun (and fast!) things with dates by mapping them to geospatial types. For an example see: http://explainextended.com/2009/08/11/efficient-date-range-q... You can easily extend this map into more dimensions depending in your common use cases and the capability of your DB's spatial library.
Comment linking /2009/08/11/efficient-date-range-query-sql-server/
on “Show HN: Better SQL group by date”Submitted Double thinking in SQL as a story · 8 points
HN discussion>> I've asked ChatGPT to write a VBScript function that returns false if the input is true and false if the input is false. <insert to-be-fair meme here> You purposefully asked GPT a trick question for which it likely has very little training data. No one would ever go on StackExchange et al. asking how to write a function that always returns false. So GPT had to take its training data on other, realistic questions…
Comment linking /2023/12/31/happy-new-year-15/
on “Ask HN: I don't use AI. What exactly am I missing out on?”Submitted Happy New Year: GPT in 500 Lines of SQL as a story · 6 points
HN discussionFor the LLM explainer, did you point Claude at this one? https://explainextended.com/2023/12/31/happy-new-year-15/ This page Claude assisted page rhymes with that one. Sorta.
Comment linking /2023/12/31/happy-new-year-15/
on “Show HN: Beautiful interactive explainers generated with Claude Code”Submitted Happy New Year: GPT in 500 Lines of SQL as a story · 6 points
HN discussionSure, especially if you nest the sets using a datatype indexable with an R-Tree index: http://explainextended.com/2009/09/29/adjacency-list-vs-nest... However, nested sets is still very expensive to update which may be a deciding factor if your hierarchy is subject to frequent change (like, a folder-like structure with the folders being moved here and there) and you don't need to query for "all descendants" often.
Comment linking /2009/09/29/adjacency-list-vs-nested-sets-mysql/
on “Hierarchical Queries in MySQL (Function substitute for CONNECT BY)”Submitted GPT in 500 Lines of SQL as a story · 5 points
HN discussion