x

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?

more ▼

asked Feb 23, 2010 at 08:48 AM in Default

kardile gravatar image

kardile
301 14 14 14

(comments are locked)
10|1200 characters needed characters left

2 answers: sort oldest

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.

more ▼

answered Feb 23, 2010 at 09:18 AM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

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.
Feb 23, 2010 at 11:12 AM kardile
(comments are locked)
10|1200 characters needed characters left

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

more ▼

answered Feb 23, 2010 at 11:14 AM

kardile gravatar image

kardile
301 14 14 14

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x53

asked: Feb 23, 2010 at 08:48 AM

Seen: 1232 times

Last Updated: Feb 23, 2010 at 08:48 AM