Skip to content
datarekha

SQL

6 articles in this topic.

SQL Aug 15, 2026

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.

11 min read Read
SQL Jun 2, 2026

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.

9 min read Read
SQL Jun 2, 2026

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.

9 min read Read
SQL Jun 2, 2026

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.

9 min read Read
SQL Jun 2, 2026

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.

8 min read Read
SQL Jun 2, 2026

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.

10 min read Read