Fan traps in business intelligence, Part 1

Fan traps in business intelligence, Part 1

What is a "fan trap"?

A "fan trap" is an age-old SQL problem with a relatively new moniker. A fan trap refers to the linked one-to-many related tables involved in a SQL query join. The inclusion of such fanned-out one-to-many joins can cause incorrect results to be returned especially if the query includes attributes from multiple tables in the joins. The incorrect results are referred to as Cartesian products.

A typical business intelligence query is focused on performing aggregation of "fact(s)" or "measures" in a fact table. If the query involves a "fan trap", the returned Cartesian product result-set will cause the output "fact(s)" to be incorrect, i.e. overstated, many times over.

A "fan trap" example: customer, order, order detail:

Entity name Relationship Entity name
Customer One to many Order
Order One to many Order detail

For the example above if a query is summing total order value from order entity and total order lines from order detail for a "John Doe" customer, then the resulting query will produce incorrect "order value" totals as below.

Customer Order value Product name Order lines
John Doe $10000.00 Shampoo 50

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning editorial writers on the latest customer relationship management (CRM)and call center technology issues today. Our goal is to keep you informed on the hottest issues facing this fast-changing industry.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchCRM.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchCRM.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

John Doe $10000.00 $10000.00 300
John Doe $10000.00 Toothpaste 200
Totals $30000.00   550

For more information, check out SearchCRM.com's Best Web Links on Business Intelligence.


This was first published in September 2002

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.

    Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.