Re:SQL queries don't start with SELECT
by curryhoward on Friday October 04, 2019 @12:48AM
(#21154849)
The author makes it crystal clear that she is not advocating this as a mental model for the execution of the query:
Database engines don’t actually literally run queries in this order because they implement a bunch of optimizations to make queries run faster – we’ll get to that a little later in the post.
So:
- you can use this diagram when you just want to understand which queries are valid and how to reason about what results of a given query will be
- you shouldn’t use this diagram to reason about query performance or anything involving indexes, that’s a much more complicated thing with a lot more variables
She claims this is a useful tool to understand the denotational semantics of the query and which kinds of queries are allowed vs. not allowed—and she's absolutely right.
Re:SQL queries don't start with SELECT
by filleduchaos on Friday October 04, 2019 @04:59AM
(#21155973)
A point that the article makes in multiple places, but I suppose it absolutely bore you repeating it once more.
It's absolutely useful as a debugging tool to build up some semantic understanding of what the query means, and I encourage every database user to learn to use EXPLAIN, but relying on a mental execution model is borderline dangerous.