Best practice for SCD2 start and end dates
5 posters
Page 1 of 1
Best practice for SCD2 start and end dates
What is the best practice for setting the end date of the prior row?
1. Same as effective date for current row?
2. Day prior to the effective date for current now?
3. Day prior at 11:59.999?
4. Something else?
I've seen 1 & 2 in Kimball examples before, not sure which is the accepted best practice these days.
Thanks,
Nemo
1. Same as effective date for current row?
2. Day prior to the effective date for current now?
3. Day prior at 11:59.999?
4. Something else?
I've seen 1 & 2 in Kimball examples before, not sure which is the accepted best practice these days.
Thanks,
Nemo
nemo9123- Posts : 2
Join date : 2014-07-07
Re: Best practice for SCD2 start and end dates
Generally the end timestamp should be set to some time prior to the new start timestamp. Such as subtracting a millisecond from the new start. This allows use of BETWEEN, which is an inclusive range, when filtering.
If you are using a DATE type which does not carry time of day (this varies by database) then the end date should be the day prior to the new start date.
If you are using a DATE type which does not carry time of day (this varies by database) then the end date should be the day prior to the new start date.
Re: Best practice for SCD2 start and end dates
I've worked places that use both of those solutions. Most of the companies set effective start equal to the previous row's end date or timestamp if you do multiple loads during the day. Either way works.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
Re: Best practice for SCD2 start and end dates
Thanks guys, I've seen it done all different ways, wasn't sure what consensus was on "best". Thanks!
nemo9123- Posts : 2
Join date : 2014-07-07
Re: Best practice for SCD2 start and end dates
I think there is a 'best', and it is the solution proposed by ngalemmo.
The use of BETWEEN should not be disregarded. Even if it is not part of your original plans, someone, somewhere, will use it in future.
Ron.
The use of BETWEEN should not be disregarded. Even if it is not part of your original plans, someone, somewhere, will use it in future.
Ron.
Re: Best practice for SCD2 start and end dates
I agree.
If you set end_time = start_time on "sequential" Dim records then you have to introduce logic to use either ">= Start_time" or "<= end_time" when determining the applicable Dim record.
If your set end_date < start_date so that the Dim records don't overlap there can never be any confusion
If you set end_time = start_time on "sequential" Dim records then you have to introduce logic to use either ">= Start_time" or "<= end_time" when determining the applicable Dim record.
If your set end_date < start_date so that the Dim records don't overlap there can never be any confusion
nick_white- Posts : 364
Join date : 2014-01-06
Location : London
Similar topics
» Start and Finish dates and role-playing dimensions
» can i use other two effective dates column in SCD2
» Where do we start the Bus Martrix with ?
» Combination of SCD2, partial snowflake, Effective and end dates in fact table
» Fact with eff / exp dates referencing dimension with eff / exp dates
» can i use other two effective dates column in SCD2
» Where do we start the Bus Martrix with ?
» Combination of SCD2, partial snowflake, Effective and end dates in fact table
» Fact with eff / exp dates referencing dimension with eff / exp dates
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|