Discussion about Late Arriving Dimensions

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I have always used -1 and 0 and preloaded them in to my dimension tables. That way when the lookup failed then you switch to -1 or 0 based on design. Sometimes 0 is unknown and -1 is late arriving. Specific industries have more of these issues than others like healthcare insurance. PPO are the worst because they do not load members until they have a claim on them. So until a child has a doctor's visit he is not in the system. Sometimes they delay loading the child until all business rules are validated like age and relationship verified manually through a benefits admin. Complicates the loading of the fact table. A claim may get paid and later denied because the child is not eligible.

Sometimes there are multiple systems involved like membership is a different system than claims. So claims are paid and they become facts. So the claims system has a member number that is different than the membership member id. Basically there are 2 dimensions for members. One for each system. At some point the member is unknown and/or late arriving. Usually there is a clean up step to identify these after the load. That is where it gets messy.
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I never want to call a stored procedure during ETL. I have lost control. I am now reliant on an outside process to load data. It is also database specific. The purpose of ETL tools is partly to be database independent.

I always preload -1 and 0 just for performance.

Please give an example of your late arriving dimensions. Always want to know the business reason for something out of the norm.
Mamu Kim
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

But how would you decide if there are more than one missing value. Do you keep decrementing the negative number? Once true dimension values do arrive, how do you differentiate that -1 is "Parsley" and -2 is "Tomatoes"?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

My current (non-DataStage) project is taking a "pre-load" approach as well. After all of the dimensions have been updated from their sources, the incoming daily fact data is thrown up against each dimension and we create "stub" records for anything late arriving. They get a real surrogate key and as much data as they can from the fact data but are marked in an attribute column as a stub so we know their source. Hopefully later the "real" data will arrive (all dimensions are type 2) but in the meantime we have the RI we need.

To address your concern about checking 'all' of the fact data, we're just checking against the new fact data that arrived that day. Even when that volume is 'large' the amount of time it takes to pull distinct values from the incremental source data is minimal.

We also have a "-1" record in all appropriate dimensions for the unknown or "NA" joins against the fact where the source column in the fact is "empty".
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Maybe I did not take my smart pills today but even if you mark these records as stub records and assign a true surrogate key without a natural key(the dimension code), how are you later going to identify and assign the right stub record with its correct dimensional value.
Sorry OP for hijacking your thread, I am just interested on how this process works.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We have the natural key from the fact data. In many cases that's all we have, making the stub dimension records extremely... stubby. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
evee1
Premium Member
Premium Member
Posts: 96
Joined: Tue Oct 06, 2009 4:17 pm
Location: Melbourne, AU

Post by evee1 »

DSguru2B wrote:Maybe I did not take my smart pills today but even if you mark these records as stub records and assign a true surrogate key without a natural key(the dimension code), how are you later going to identify and assign the right stub record with its correct dimensional value.
Sorry OP for hijacking your thread, I am just interested on how this process works.
I have opened this thread to learn about and discuss various approached, so its pursose is educational rather than just to solve a certain issue. So you are welcome to "hijack" it and share your thoughts. I hope this is OK on this forum :D.

As for you questions, in the case of "generic" -1 dimension record (where you have only one dummy -1 for all the missing "Pumpkin", "Gorgonzola" and "Walnuts"), you have to store natural key in the fact table if you want to update the fact with the surogate key of the dimension that has (eventually) arrived. The updates of the fact become somewhat convoluted as well, expecially in the case of Type 2 facts.
Also, in my opinion, misses the point of having dimensions and facts altogether, as you store natural key in both of them.
chulett wrote:To address your concern about checking 'all' of the fact data, we're just checking against the new fact data that arrived that day. Even when that volume is 'large' the amount of time it takes to pull distinct values from the incremental source data is minimal.
I agree. Unfortunately the 600 milion rows I have mentioned before is the new fact data - it's a sales forcast for a month. That's why I try to find the solution that would aviod pre-scanning of this data. But in the end the pre-load solution may end up being the most efficient after all.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

DSguru2B

Usually there is a natural key in the fact to relate rows in the target back to the source. So in my example you might have a claim number. You have to go back to the source where you have to check to see if these unknowns have arrived. So basically you have to reprocess these rows. So you get claim numbers from your fact table. Probably load them into a temp table on the source and use you normal job to process these rows except the SQL now joins the temp table to the claims table. A lot of sites put the natural keys in shadow tables but the concept is the same only you have to join the fact table to the fact shadow table. Usually the keys for a fact or dimension table is the same surrogate for the shadow table. This makes you target tables a little narrower. I find the end users are very comfortable seeing their natural keys in the warehouse tables. The trouble is they use them in where clauses too much which kills performance unless you put indexes on these columns. Multiple sources complicates this a lot.

You are correct there is no way to fix this with the information in the data warehouse. Maybe Craig's stub idea is the same as what I described. I am not sure.
Mamu Kim
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

My normal method is to set the dimension -1 however it depends on how you want to go back and fix the mess later when the real data comes through. If you have a natural key and no other attributes then the benefit of creating a new dimension row with empty values is that you can fix up that dimension later with a standard slowly changing dimension job that keeps that dimension up to date. You do not have to go back and fix any fact rows. If you set the dimension to -1 then you need a slowly changing fact job - a job that goes back and corrects old fact records when new dimension rows arrive and repoints those old fact rows to the new dimension rows with the corrected surrogate key values.

On very large fact tables it is best to avoid having to go back and modify old fact records. On Fact tables that are supposed to be modified such as accumulating fact tables it may be okay to use the -1 dimension approach.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Right, we had zero desire for any need to go back and modify old fact records for late arriving dimensions. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

kduke wrote:Usually there is a natural key in the fact to relate rows in the target back to the source.
Thats reprocessing. That makes more sense now. The world makes sense again :)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
evee1
Premium Member
Premium Member
Posts: 96
Joined: Tue Oct 06, 2009 4:17 pm
Location: Melbourne, AU

Post by evee1 »

Thanks you all for our contribution.
Post Reply