Join Fanout Hunt

Find why a total is inflated or a row count grew after a join, and fix it at the grain instead of hiding it: write the grain of every input in one sentence, compare COUNT(*) with COUNT(DISTINCT key) after each join while bisecting the query join by join, classify the cause as many-to-many, a dimension not unique on its key (an unfiltered type-2 history table, overlapping validity ranges) or duplicate source rows, and fix by pre-aggregating to the join grain, never by DISTINCT on the output. Use when revenue is 3x too high after adding a join, a model's row count doubled, a SUM disagrees with its source table, or someone proposes SELECT DISTINCT to make the numbers match. Not for a slow query (sql-performance), two dashboards disagreeing on one metric (metric-reconciliation) or designing new tables (schema-design).

greenblacked Updated
The twenty-nine plugins: coding, family, gamedev, operations, delivery, security, manager, personal, career, design, llm, data, techdocs, assurance, client-apps

File contents

greenblacked/AI commit 2388f7c0d1

Frequently asked questions

npx get-skill add greenblacked/join-fanout-hunt