November 28, 2006 at 7:38 am
we have a DTS runnung wich perform update and inserts into a table. And since the DB grows we get more and more table locks.
Could somebody help?
November 29, 2006 at 7:23 am
Any chance you could post some more info for us? How about, your SQL statements to do you updates as well as table design for starters... Take a look at your indexes and see if you can't improve them to make your updates and inserts run a bit faster.
What kind of locks are you seeing?
November 29, 2006 at 9:14 am
The best way to prevent table locks is to limit the number of rows that are part of each transaction. Commit inserts every few thousand rows, perform updates in a loop that only updates a few thousand at a time.
November 29, 2006 at 9:18 am
Scott,
how should i commit the insert every few thousands rows?
November 29, 2006 at 9:57 am
What is the data source ? SQL or non-SQL ?
Instead of a long-running row-by-row DTS process, you can minimize Insert/Update duration and duration of locks by pulling the data into a SQL staging table, then using set-based Insert/Update statements between 2 SQL statements.
November 29, 2006 at 2:44 pm
Look at the options for the data pump task. The default is to commit all rows in one transaction, but you change it to commit every x number of rows. The insert will probably run faster and hold fewer locks if it is committed in smaller blocks, but you have to consider how you would recover if the package failed with only half of the rows committed.
Pulling the data into a staging table before doing inserts/updates would probably make the package run faster, but if you are updating a large number of rows in a heavily-used table you may still run into locking issues. You might still want to put the inserts & updates (from the staging table) into loops of a few thousand rows at a time.
You might also look at the execution plan for the inserts/updates to see if it is using indexes efficiently. If there are a lot of indexes on the table it will slow down updates and inserts. You could look into whether the table is getting badly fragmented with all the updates and inserts.
December 5, 2006 at 1:26 am
Hello All,
we could resolved the problem separating the select from insert /update instructions. But it s strange that we didnt had this problem before. And the number of row did not increase.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply