Update, Insert and Delete slowly changing table

  • I have a reporting table that needs to be changed on a daily basis. The source data is created on the fly and is a result of multiple queries that join data from 12 tables. That said...this record set doesn't change very much. Maybe a few thousand records per day.

    Up to this point I've been truncating and recreating the target table. Unfortunately, the table has grown too big to continue with this method and I'd like to hear about some other methods that you guys are using. Such as MERGE or other creative T-SQL solutions. I'm not opposed to SSIS, but would like a more simple and elegant SQL approach if possible. And as always, performance is a key factor.

    Thanks

  • I believe that you need to give us more detail. Why is it being slow? Is it the query to generate the source data? Or just writing the table to disk?

    Multiple paths are possible, but without details anything would be a shot in the dark.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • My apologies... The only thing that is slowly changing is the data itself. There are only a few UPDATEs and a couple thousand INSERTs to the source data on a daily basis.

    I would like to get away from TRUNCATEing the target table every single day and instead only UPDATE / DELETE changes and INSERT new records.

    I hope that makes more sense.?

Viewing 3 posts - 1 through 2 (of 2 total)

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