When to use Rebuild Index Task

  • In our data warehouse (SS2K5) SSIS ETL procedure, most tables are truncated before data is reloaded (using a basic Data Flow OleDBSource -> OleDBDestination). Now, after data is reloaded, indexes are rebuilt using the Rebuild Index Task. This is a quite time consuming procedure for large fact tables with many indexes.

    My question is: Is there any point in performing an index rebuild for these tables, where data is only inserted after truncation (no updates or deletes)?

    The question is really a more general SqlServer question: Will an index that is rebuilt after all data has been inserted (no updates or deletes) be any better than that which was built during the inserts? Is the indexing procedure capable of optimizing an index based on the total set of data, i.e. by 'higher level' data analysis?

  • Please give me one more chance to understand how your SSIS package works.

    Your package do the following tasks:

    1. Truncate,

    2. Transfer data

    3. Reindex.

    Is your package works this way?

  • Marek Powichrowski (11/22/2007)


    Your package do the following tasks:

    1. Truncate,

    2. Transfer data

    3. Reindex.

    Is your package works this way?

    Yes, correct. And the question is if reindexing is just waste of time.

  • Second question: after truncation all indexes in destination tables are fully operational (during insertion) or are removed?

  • All indexes are fully operational after truncation and during inserts/data transfer, which is what makes me suspect the index rebuild is not needed.

    For the record: I have not developed these ETL packages myself. The responsibility has recently been handed over to me, and I have just begun digging into them to see how they can be optimized.

  • vebjornwa (11/22/2007)


    All indexes are fully operational after truncation and during inserts/data transfer, which is what makes me suspect the index rebuild is not needed.

    Yes, I think the same. But reindexing may improve performance (but not huge amount) and it may be done form time to time (may be at midnight on saturday).

  • Try to do reindexing as separate task, not as ETL task.

  • Marek Powichrowski (11/22/2007)


    vebjornwa (11/22/2007)


    All indexes are fully operational after truncation and during inserts/data transfer, which is what makes me suspect the index rebuild is not needed.

    Yes, I think the same. But reindexing may improve performance (but not huge amount) and it may be done form time to time (may be at midnight on saturday).

    The tables we are talking about are truncated and filled every night, so doing reindexing from time to time (once a week, as suggested) would be meaningless (?). What I suspect is that the index that results from an index rebuild will be identical to the index that exists after data insertion is complete. (Recall that after truncation, only inserts are performed, never any updates or deletes.)

  • Yes, indexes should be clear after truncation and never be rebuilded during all lifecycle of your DW (till next truncation). So there is no need to reindex indexes in your ETL process.

Viewing 9 posts - 1 through 8 (of 8 total)

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