HN Hall of Fame Weekly email

SQLite: Outlandish Recursive Query Examples

www.sqlite.org Reference Documentation & references Software engineering Candidate
Screenshot of www.sqlite.org captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 7 calendar years, with breakout response in 2 of them.

submissions
14
submitters
14
observed span
2018–2026
peak thread · 54 comments
201 pts
latest 20+ return · 2024-11-24
201 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

No matter how much time I spend contemplating recursive CTE examples, I just cannot “get it” enough to write my own without a lot of trial and error and head-scratching. I would love to take a 2 hour class on “thinking in SQL for hackers” or something, but I haven’t really found anything to improve my mental model from “broken” to “working” so far.

jitl·201-point thread·

"Udo of Aachen" was the first fictional monk to find the "Mandelbrot" set: https://users.math.yale.edu/public_html/People/frame/Fractal...

I've been been experimenting with recursive queries in SQLite, and they seem rather unreasonably performant. I've tried comparing the performance of some of the given examples with imperative code that duplicates the recursion and makes the requisite queries individually using the SQLite API. You might expect the CTEs to perform better, but I've seen them doing an order of magnitude better, which rather surprised me. Congratulations to the author who must have made some rather intensive optimizations to make…

I was just reading up on sqlite's docs to create a common table expression to return a graph of records stored with single table inheritance. Came across these gems in the docs: a mandelbrot set approximation visualizer and a sodoku solver.

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
447

reference only — not used in Hall rules or ranking

Total comments
85

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2018-02-08Plot the Mandelbrot Set in SQLite Using `WITH RECURSIVE' Clauseigravious20
2018-09-04SQL Sudoku Solvercrawshaw20
2020-02-20SQL query to generate the Mandelbrot set as ASCII artFirst breakoutmmoez19329
2020-02-22SQLite Query to Solve Sudokuflying_sheep310
2021-02-04How recursive CTE workkdfisr10
2021-06-23Outlandish Recursive Query Examplestim_sw40
2022-12-20Outlandish Recursive Query Examplestantaman10
2023-02-01Found in the SQLite Docs: Sudoku Solver and Mandelbrot Set Approximationpfarrell31
2023-02-12Approximate fractal and solve sudoku with SQLiteazurvii20
2023-03-11Outlandish Recursive Query Examplespkilgore41
2024-06-01Outlandish Recursive Query Examples8organicbits10
2024-11-24SQLite: Outlandish Recursive Query ExamplesBest thread · Latest 20+ point returnRendello20154
2026-02-10Solving Sudoku with SQLiteTheCleric10
2026-05-14Outlandish Recursive Query Examplessmartmic10