SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Managing Data Removal Using SSIS


Managing Data Removal Using SSIS

Author
Message
Frank Banin
Frank Banin
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 425
Comments posted to this topic are about the item Managing Data Removal Using SSIS

Frank Banin
BI and Advanced Analytics Professional.
RonKyle
RonKyle
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2852 Visits: 3505
I applaud your SSIS skills. I'm concerned, however, why you would want to take such a drastic approach and that others reading this will think that this is normal.

I know you may say the Dim Time and the Dim Geography were just examples, but you have chosen tables that in a warehouse are very stable (I'm assuming that caling them dim(ension) indicates that they are part of a warehouse).

I also don't understand why it would be possible to truncate these tables as they should be joined to the fact tables they support.

There may be times such a drastic approach is necessary, esp at the start when it's the fastest way to do an ETL, but it's not usually the best.

It might be helpful to understand the circumstances that make this approach necessary.



amenjonathan
amenjonathan
SSC Veteran
SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)

Group: General Forum Members
Points: 258 Visits: 434
In my warehouse all the ETL happens in a stage DB where I don't have any FKs, so I just truncate the tables before reloading. I usually am only loading about 12 hours of data into these tables; as opposed to the entire 2+ years I currently have available in the fact tables, so space is not a huge issue. I never truncate my production tables. I MERGE data into them.

OLTP -> Truncate/ETL to Stage DB -> MERGE to production tables

Just my two cents. Might be an easier approach for you.

-------------------------------------------------------------------------------------------------
My SQL Server Blog
RonKyle
RonKyle
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2852 Visits: 3505
Still don't understand why you truncate the Time dimension table. I assume that's the date, but either way, the calendar is not changing.



Frank Banin
Frank Banin
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 425
Personally, I can't think of a good scenario where you will want to make these two tables a part of a recurring full load ETL processes.
Actually in my initial design, the [dbo].[TableList] held tables that you wouldn't want to truncate, I just switched the design around, that's why these two example.

With that said, you will realize that in the article I stayed completely away from ETL architecture or DW design so that data removal is at the descretion of whoever is using the tool. I tried to design the package as a utility tool with a sole purpose of data removal in any scenario one may chose, leaving the responsibility of what to delete in the hands of the user.

Frank Banin
BI and Advanced Analytics Professional.
amenjonathan
amenjonathan
SSC Veteran
SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)SSC Veteran (258 reputation)

Group: General Forum Members
Points: 258 Visits: 434
One thing to worry about when you truncate tables with FKs is what if you can't rebuild the table where the keys you were using will match with the new keys generated? Assuming you're using an IDENTITY surrogate key. This is probably my biggest concern with trucating any production table with FKs. If you aren't sure they match, you have to regenerate all the keys in the child table's column with a big UPDATE.

But still could be a good tool if you need to truncate some tables with FKs. Always good to see people building new tools! =)

-------------------------------------------------------------------------------------------------
My SQL Server Blog
Frank Banin
Frank Banin
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 425
Yes you are right. I believe, as a best practice any environment where surrogate keys are generated to track dimension or for that matter for any form of versioning are not meant for truncations, especially DWs. RI enabled ODSs with no versioning proceses based on surrogate key may be good candidate. But Ideally, as noted in the summary it is useful upstream and downstream of the DW, it becomes especialy useful in EDW project where you are trucating data in an RI enabled staging area(s) for mutiple source systems, for instance where you are integrating data for corporation with many different companies.

Frank Banin
BI and Advanced Analytics Professional.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search