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.<p>Congratulations to the author who must have made some rather intensive optimizations to make recursion work so well within the context of SQL, which the paradigm was not designed for.