SQL Explain And Set Based Thinking

Guides the two performance habits that matter most — think in sets, not rows, and measure the plan instead of guessing. Replaces the N+1 / RBAR ("row-by-agonizing-row") antipattern — application code looping to issue one query per row, or a correlated per-row subquery — with a single set-based query (`JOIN`/`IN`/`VALUES`/`LATERAL`). Auto-invokes when writing or editing per-row query loops in application code, a correlated per-row subquery, `EXPLAIN`/`EXPLAIN QUERY PLAN` output, or on "why is this slow" / "optimize this query" / "N+1" requests. Routes plan reading and set-thinking for the whole plugin.

ctoth 858143d 3 files · 30.7 KB Updated

File contents

ctoth/sql-skills-plugin/tree/main/plugins/sql/skills/sql-explain-and-set-based-thinking commit 858143daef

Frequently asked questions

npx skillmds@latest add ctoth/sql-explain-and-set-based-thinking