Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Incremental fact update concept Expand / Collapse
Author
Message
Posted Saturday, August 18, 2012 1:52 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, October 07, 2012 2:46 AM
Points: 1, Visits: 129
Hi,

My source table is Transactions, which has ID, Value and Date, It reflects history of transactions.
My fact holds transactions time frame, each row has ID, Value, StartDate and EndDate.

The incremental process takes the delta transactions.

In first run Transactions table is:
Transactions: ID: 1, Value: 500, Date: 2012-08-01
The incremental process takes this single row to staging and copy to fact:
Fact: ID: 1, Value: 500, StartDate: 2012-08-01, EndDate: NULL

In second run Transactions table is:
Transactions: ID: 1, Value: 500, Date: 2012-08-01
Transactions: ID: 1, Value: 600, Date: 2012-08-02

The incremental process takes the second row to staging and copy this row to the fact:
Fact: ID: 1, Value: 500, StartDate: 2012-08-01, EndDate: NULL
Fact: ID: 1, Value: 600, StartDate: 2012-08-02, EndDate: NULL

BUT the EndDate of the first row should be update as well:
Fact: ID: 1, Value: 500, StartDate: 2012-08-01, EndDate: 2012-08-02
Fact: ID: 1, Value: 600, StartDate: 2012-08-02, EndDate: NULL

Now, the question is:
Should all FACT retro change rows (those records that exist in FACT but not in the incremental delta records but still needs to get update in FACT) get into STAGING table first (extract), get update (transform), and then to return to FACT (load)? If yes - should it get from source table or from FACT table?
Should this update should be done directly on the FACT (update previous row EndDate with next row StartDate)?

Thanks in advance!
Post #1346820
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse