April 22, 2016 at 9:03 am
I have a theoretical question.
When working with the Dimension table, if i have EffectiveDate and EndDate is there also a reason to have a CurrentRowFlag Column?
Looking for some scenarios for either or! (not a "It Depends" answer :-))
April 24, 2016 at 5:13 am
A benefit of having a CurrentRowFlag column is that you can create a filtered index on it. That is not possible with EffectiveDate and EndDate only because you cannot compare to GETDATE() or CURRENT_TIMESTAMP in the WHERE clause of a filtered index.
A drawback of having a CurrentRowFlag column is that it increase the size of the row on disk, which depending on the size of the table may or may not be a problem. Also, you need to set up some process to keep this column current, not only when the EffectiveDate and/or EndDate change but also when time passes without the rows changing. If you do a complete reload often enough you will get this for free, but if you do incremental loads or if your load frequency is too low you will have to set up a process to update this column when the current date and time pass the EffectiveDate and/or EndDate thresholds.
April 24, 2016 at 7:18 pm
SolveSQL (4/22/2016)
I have a theoretical question.When working with the Dimension table, if i have EffectiveDate and EndDate is there also a reason to have a CurrentRowFlag Column?
Looking for some scenarios for either or! (not a "It Depends" answer :-))
It actually does "depend". 😉 Were the designers smart enough to make EndDate a NOT NULL column with a default of '99990101' (or some such) or were they the same as most people that have slow performance for such an SCD table and allowed NULLs in the EndDate column?
Personally, I'd avoid the need for the "CurrentRowFlag" column like the plague.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 25, 2016 at 9:47 am
Thank you Hugo Kornelis and Jeff Moden for the feedback.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply