Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design of a data warehouse with more than one fact tables

Tags:

I'm new to data warehousing. First, I want to precise than my copy of The Data Warehouse Toolkit is on it's way to my mailbox (snail mail :P). But I'm already studying all this stuff with what I find on the net.

What I don't find on the net, however, is what to do when you seems to have more than one fact in a DW. In my case (insurance), I have refunds that occur on a non regular basis. One client can have none for 3 months and then ten in the same months. On the other hands, I have "subscription fee" (not sure what is the correct english term, but you get the point), that occur every month or every three months. That seems clearly like two distinct facts to me.

Those two are kind of loosely coupled by some dimensions, like the client or the "insurance product". Now are these two different warehouse, on which I have to produce two different report and then connect the reports outside of the DW ? Or is there a way to design this to fit a single descent DW. Or should I combine these two facts in one? I would probably lose granularity on refunds then.

Some blog I read said a DW always has one fact table. Others mention the step of designing what are the fact tables with a S, but there is no clear instruction of if there is a link between them or they are just distinct components of a same DW project.

Does anyone know some references on that precise part of DW design?

like image 316
user327961 Avatar asked Jul 22 '10 12:07

user327961


People also ask

Can a data warehouse have multiple fact tables?

A data warehouse can have more than one fact table. However, you do want to minimize joins between fact tables. It's ok to duplicate fact information in different fact tables.

Can we have more than 1 fact table in a data model?

You can have a single Date Dimention and conect it to multiple fact tables. Just be aware that when you filter the dimension date you will be filtering both fact tables.

Can we have 2 fact tables in star schema?

Star schema contains only one fact table.

How many fact tables can you have?

There are four types of fact tables: transaction, periodic snapshot, accumulating snapshot and factless fact tables. Every flavor serves a purpose in representing the underlying business which the data warehousing system supports.


1 Answers

I realize that I am answering an old post, but I am not satisfied with either of the answers provided. I feel that neither answered the question.

A schema can have one or more facts, but these facts are not linked by any key relationship. It is best practice not to join fact tables in a single query as you would whey querying a normalized/transactional database. Due to the nature of many to many joins, etc - the results would be incorrect if attempted.

The answer you are looking for is that you need to "drill across" which basically means that you are querying each fact table (schema) separately and merging the results. This can occur using SQl or preferably via a reporting/analytics tool that you may have which referenced the data warehouse. Instead of duplicating the answers on how to do this, I will direct everyone to two very good articles:

Three ways to drill across by Chris Adamson

and

Should of the Warehouse - Drilling Across by Ralph Kimball

like image 172
JJ3 Avatar answered Oct 05 '22 22:10

JJ3