Managing Data Removal Using SSIS

  • Comments posted to this topic are about the item Managing Data Removal Using SSIS

    Frank Banin
    BI and Advanced Analytics Professional.

  • 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.

  • 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

  • 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.

  • 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.

  • 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

  • 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.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply