question

kardile avatar image
kardile asked

Update on partitioned table

I have a transaction table with columns like id, date, product, value, etc. The table has been partitioned based on date column and have around 5m records per partition.

I have to develop a ETL(SSIS) build to populate an additional derived column and logical query would be...

        Update    transaction 
        Set xxx= value 
        where id =100

What changes should i do in the above query to use benefits of partition elimination, partition parallelism etc?

partitioning
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

What is the derived transformation you are doing? Does it depend on other data from the database or just other data in the row?

As far as I know, the best idea would be to just update it naturally, and let the query optimiser use the partitions as best it can. But, if the data only depends in other data in the row, then you may be best off with a computed column instead.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kardile avatar image kardile commented ·
The derived value is based on "product" that is a part of row and other data(from table). This derviated value req. a week delay and should be calcuated a week after the original record insertion in the transaction table.
0 Likes 0 ·
kardile avatar image
kardile answered

If i keep simple update then it takes hours to complete the update hence looking for a method to force optimiser to use partition.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.