// recent writing

Long-form essays, no listicles.

FEATUREDSQL FUNDAMENTALS

Self-joins without the headache: a sql self join example that sticks

A self-join is a normal join where a table is compared against itself. It looks scary until you give the two copies different names, then it's just a join like any other.

7 min read25 Jul 202636 reads
Read the essay →
// query optimisation

When indexes help vs hurt: the write cost nobody mentions

An index isn't free. It speeds up the reads that use it and slows down every single write to that table. Knowing which columns are worth it is the actual skill.

12 Jul 202612 min
// quick commerce

Quick-commerce metrics: what changes when delivery speed IS the product

10-minute delivery isn't just fast e-commerce. It's a different business with its own metrics: SLA breach rate, dark-store utilization, and delivery cost per order.

12 Jul 202613 min
// sql fundamentals

NULL handling: what 'blank' really means in SQL

NULL isn't zero and isn't an empty string, it means 'unknown.' And comparing anything to 'unknown' gives you 'unknown,' which quietly drops rows you expected to keep.

12 Jul 20267 min
// window functions

LAG, LEAD, FIRST_VALUE: peeking at the row before or after

Comparing a row to its neighbor used to mean joining a table to itself. LAG and LEAD let a row see the previous or next row directly, in one line.

12 Jul 20269 min
// window functions

Frame clauses: ROWS vs RANGE, the setting that decides what a window function sees

Every window function looks at a 'frame', a slice of nearby rows. ROWS counts physical rows; RANGE counts by value. They usually agree, until there are duplicate values.

12 Jul 202611 min
// query optimisation

Predicate pushdown: why the database filters earlier than you wrote it

The database quietly reorders your query so filters happen as early as possible, before an expensive join, not after. Knowing when it CAN'T do that is what matters.

12 Jul 20268 min
// query optimisation

Materialised views: saving a query's answer instead of recomputing it

A regular view re-runs its query every time you read it. A materialised view runs it once and remembers the answer, until you tell it to refresh.

12 Jul 20269 min
// interview prep

Resume that gets shortlisted: what a recruiter actually reads in 8 seconds

A resume isn't read carefully at first, it's scanned fast. Knowing what a recruiter's eye actually catches in those first few seconds changes how you should write every line.

12 Jul 202611 min
// interview prep

Product sense framework: a repeatable structure for 'how would you improve X'

Open-ended product questions don't reward improvisation. A simple, repeatable structure, walked through out loud, outperforms a great idea with no visible process.

12 Jul 202614 min
// query optimisation

Reading an EXPLAIN plan: asking the database to show its homework

EXPLAIN looks like noise at first. Once you know three things to look for, it tells you exactly why a query is slow.

12 Jul 202615 min
// query optimisation

Nested loop vs hash join: how the database actually performs a JOIN

Your SQL never says HOW to do a join. The planner picks from three strategies based on table size and indexes. Knowing them tells you what a slow join is actually doing.

12 Jul 202611 min
// query optimisation

Partitioning: splitting a big table so most queries only touch a slice of it

Partitioning doesn't shrink a table. It splits it into pieces so a well-aimed query only has to open the piece it needs.

12 Jul 202610 min
// window functions

Pivot & unpivot: turning rows into columns, and back again

A pivot turns a long list of transactions into a spreadsheet-style grid. Unpivot does the reverse. Neither is a keyword in Postgres, both are patterns you build by hand.

12 Jul 202610 min
// product analytics

The North Star metric: the one number a whole team rallies around

A North Star metric is the single number a company trusts most to mean 'the product is genuinely getting better.' Most teams accidentally pick the wrong one.

12 Jul 202610 min
// sql fundamentals

Subqueries vs CTEs: a query inside a query, made readable

Both let you use the result of one query inside another. A CTE just gives that inner query a name up front, so the whole thing reads top to bottom instead of inside-out.

12 Jul 20267 min
// experimentation

Reading an experiment readout: five checks before you trust it

A readout with a green checkmark and a big lift number is exactly the moment to slow down, not speed up. Here's what to check before believing it.

12 Jul 202610 min
// product analytics

Retention curves & cohort tables: the chart that tells you if a product really works

One retention number tells you almost nothing. Grouping users by when they joined, and tracking each group over time, is the closest thing analytics has to a truth serum.

12 Jul 202614 min
// product analytics

Funnel decomposition: finding exactly which step is broken

One overall conversion rate tells you something's wrong. Breaking it into step-by-step numbers tells you what, and that's the entire skill.

12 Jul 202612 min
// sql fundamentals

DISTINCT, LIMIT, aliases & ordering: the small everyday tools

Four little tools you'll use in almost every query: remove duplicates, cap the rows, rename columns, and sort by more than one thing.

12 Jul 20265 min