Skip to content

Stockertim Dictionary · Technology

Join fan-out

Also called row fan-out, join explosion, row multiplication in joins

In short

The unintended multiplication of rows when a join key appears more than once on one side, which repeats rows and inflates any totals calculated afterwards.

  • Intermediate
  • Concept
  • Checked

In detail

Fan-out happens because a join pairs every matching row with every other matching row. If a customer appears once in the customers table and has three orders, joining customers to orders correctly gives three rows. But if the customers table accidentally holds that customer twice, the join gives six rows, and every order is now counted twice.

The damage shows up in aggregates. A SUM taken after a fan-out adds the same amount several times, and a COUNT counts the same order more than once. Because the query runs normally and the numbers look plausible, the error can travel all the way into a published report. The bigger the duplication, the bigger the overstatement, and two fanned-out joins in one query multiply each other.

A related trap arises when two child tables are joined to the same parent at once, say orders and refunds both joined to customers. Each order pairs with each refund for the same customer, so a customer with four orders and two refunds produces eight rows, and both totals are inflated.

Prevention starts with knowing the grain of each table: what one row represents and which columns are unique. Before joining, a quick query such as SELECT key, COUNT(*) FROM table GROUP BY key HAVING COUNT(*) > 1 lists duplicate keys. After joining, the row count and a control total should match what was expected. When two child tables are involved, summarise each to one row per key first and join the summaries.

Worked example

A clinic network in Ibadan joins 1,000 appointment rows to a patients table to total fees by patient group.

  1. Fees in the appointments table total ₦5,000,000 before the join.
  2. Fifty patients appear twice in the patients table after a botched import, and they have 100 appointments between them.
  3. The join returns 1,000 + 100 = 1,100 rows, and the fee total becomes ₦5,000,000 + 100 × ₦5,000 = ₦5,500,000.

Comparing the fee total before and after the join exposes a ₦500,000 overstatement, traced to the 50 duplicate patients.

In practice

Experienced analysts check every join with a before-and-after row count and a control total, and document the grain of each table they use. Data teams often add uniqueness constraints or automated tests on key columns so that duplicates are caught before anyone reports on them.

Watch out

  • A correct-looking total is no proof: always compare it with the same total taken from the source table before the join.
  • Joining two child tables to one parent in a single step multiplies both; aggregate each first.

Learn it properly

Official sources

Facts last checked on 9 November 2026.

Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.

English