lundi 1 décembre 2014

Getting new and updated data with an archive column


I am trying to optimize an SSIS package that retrieves data from a very large transaction table that gets millions of new records daily. The plan is this:



  1. Archive column, smallint - 0=new (default constraint), 1=archived, 2=updated (trigger)

  2. Default constraint Archive=0

  3. Update trigger Archive=2

  4. Index on archive, timestamp


The SSIS package will then get all records where Archive=0, insert those into the destination then get all records where Archive=2 and update them in the destination.


What I need help with is the setting of the Archive column to 1 after the SSIS procedure is done writing new or updated rows. What would be the most efficient way of setting all of the rows processed without touching any rows that might have been inserted or updated after the initial select?





Aucun commentaire:

Enregistrer un commentaire