SQL
6 articles in this topic.
Why your index isn't being used
You built the index. The planner ignored it. Five query shapes silently disable an index, and four of them are things you wrote without thinking.
EXPLAIN: reading the plan your database hands you
Every SQL query is secretly a program your database compiles; EXPLAIN shows you that program, and once you can read it, a 30-second query becomes a 30-millisecond one.
Indexes: the data structure your WHERE clause is begging for
A single missing index turned a 12-millisecond query into a 4-second crawl — not because the database broke, but because it had no choice but to read every row.
NULL is not a value, and that wrecks your WHERE clause
NULL means unknown, so every comparison involving it yields unknown — not false — and that silent third outcome is responsible for more wrong query results than any other SQL trap.
CTEs turned my unreadable query into something I can follow
A common table expression is less a feature than a cognitive tool — it lets you read a complex query from top to bottom, in the order you actually think, instead of inside-out from the deepest parenthesis.
Window functions changed how I write SQL
The leap from GROUP BY to window functions is the single biggest level-up an analyst makes — and the intuition behind OVER, PARTITION BY, and LAG is simpler than most tutorials admit.