Identifying a Fan Trap


After completing this lesson, you will be able to:

  • Identify a Fan Trap

Fan Trap Identification

Fan traps occur when there is a one–to–many join to a table that fans out into another one–to–many join to another table.

With such a table structure and joins, you get incorrect results from the fan trap when the query includes a measure object on the middle table (B) of the table path and an object (of any kind) from the subsequent table or tables (C).

When a query is run using objects Y and Z, the inferred SQL includes tables B and C, which have a one-to-many relationship. This results in a value for the Y object being multiplied by the number of values of the Z object related to that Y object value. Like the chasm trap, the effect is similar to a Cartesian product.

You cannot automatically detect fan traps. You must examine the direction of the cardinalities displayed in the table schema.

Log in to track your progress & complete quizzes