Wednesday, March 28, 2012

Running UPDATE statements in parallel on the same table

Hi all,

Does an UPDATE statment lock the entire table or just the rows that will be affected by the UPDATE?

I ask because -

Can I run UPDATE statements in parallel on the same table on the same column. The need for doing this is because the table is a large fact table. I plan to execute the same UPDATE statements on different time sections of the data to expedite the processing.

If the UPDATE statment lock the entire table then I cannot run an UPDATE in parallel. If the UPDATE statement just locks the rows that will be affected then maybe I can because rows affected will be different for each UPDATE.

Let me know.

Thanks,

VivekIt all depends on the lock escalation

Imaging if you ad hundereds of current connections and the lock always ascended to table locks..that wouldn't be a very good RDBMS, now would it.

BOL has a good description of this if you want to read up on it.

No comments:

Post a Comment