473,805 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

deadlock help please

I have a table that every 30 minutes needs to be repopulated from
another table that is recreated from scratch just before.
What I did was this:
CREATE PROCEDURE BatchUpdProduct s AS
begin transaction
delete products
insert into products
select * from productsTemp
commit transaction
GO

This takes about 30 seconds to run. I tried it doing it with a cursor,
row by row, but it took like 30 minutes to run instead. The problem
is with the fast approach is, once in a while I get a deadlock error
in different areas trying to access the products table. Using SQL
Server 2000 by the way.
Any ideas?

Jun 15 '07 #1
3 1378
Are those section that are getting the dead lock just doing read only or
do the need to right?

Wolfing wrote:
I have a table that every 30 minutes needs to be repopulated from
another table that is recreated from scratch just before.
What I did was this:
CREATE PROCEDURE BatchUpdProduct s AS
begin transaction
delete products
insert into products
select * from productsTemp
commit transaction
GO

This takes about 30 seconds to run. I tried it doing it with a cursor,
row by row, but it took like 30 minutes to run instead. The problem
is with the fast approach is, once in a while I get a deadlock error
in different areas trying to access the products table. Using SQL
Server 2000 by the way.
Any ideas?
Jun 15 '07 #2
On Jun 15, 12:17 pm, Seribus Dragon <Seribus.n...@s eribus.comwrote :
Are those section that are getting the dead lock just doing read only or
do the need to right?

Wolfing wrote:
I have a table that every 30 minutes needs to be repopulated from
another table that is recreated from scratch just before.
What I did was this:
CREATE PROCEDURE BatchUpdProduct s AS
begin transaction
delete products
insert into products
select * from productsTemp
commit transaction
GO
This takes about 30 seconds to run. I tried it doing it with a cursor,
row by row, but it took like 30 minutes to run instead. The problem
is with the fast approach is, once in a while I get a deadlock error
in different areas trying to access the products table. Using SQL
Server 2000 by the way.
Any ideas?
Only read, the only process that writes is the one I showed above that
runs every 30 minutes

Jun 15 '07 #3
Wolfing (wo******@gmail .com) writes:
I have a table that every 30 minutes needs to be repopulated from
another table that is recreated from scratch just before.
What I did was this:
CREATE PROCEDURE BatchUpdProduct s AS
begin transaction
delete products
insert into products
select * from productsTemp
commit transaction
GO

This takes about 30 seconds to run. I tried it doing it with a cursor,
row by row, but it took like 30 minutes to run instead. The problem
is with the fast approach is, once in a while I get a deadlock error
in different areas trying to access the products table. Using SQL
Server 2000 by the way.
If it is OK for you that the batch process is the deadlock victim, you
can add "SET DEADLOCK_PRIORI TY LOW" first in the procedure.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2533
by: Scot Schneider | last post by:
I am getting quite a few deadlock errors where both sessions are trying to execute sp_execsql according to the the trace information in the error log (see below). The database is being asscessed by an application written in .NET, as well as a few people using Query Analyzer. This seems to be happening relative randomly - can't pin it to any specific circumstances. Any thoughts would be appreciated. RID: 8:1:617:37 ...
11
2523
by: hendershot | last post by:
Using SQL Server 2000 SP3a, I run the following in 2 query analizer windows on the Northwind database, the second one always gets the deadlock Msg 1205: Window 1: declare @cnt int select @cnt = 5 while @cnt > 0 begin
7
9230
by: Andrew Mayo | last post by:
Here's a really weird one for any SQL Server gurus out there... We have observed (SQL Server 2000) scenarios where a stored procedure which (a) begins a transaction (b) inserts some rows into a table (c) re-queries another table using a subquery which references the inserted table (correlated or not)
1
2360
by: debian mojo | last post by:
Hello faculties, i'm encountering a strange a deadlock problem on my remote server which is used to give application demo to the client. It has happened that on one of the databases a deadlock situation is taking place. What is the most detailed way to detect such the cause of such a deadlock to the innermost level of detail, like what statements, stored procedures and locks are causing the deadlock to occur.
3
7631
by: Nigel Robbins | last post by:
Hi There, I'm getting a deadlock when I have two clients running the following statement. DELETE FROM intermediate.file_os_details WHERE file_uid = ? AND obj_uid There is a compound index on file_uid / obj_uid. The isolation level is UR and I have set DB2_RR_TO_RS=YES. Any thoughts why I'm getting the deadlock ?
1
4246
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here. From the log it looks like the problem happens when 2 threads insert 1 record each in the same table and then try to aquire a NS (Next Key Share) lock on the record inserterd by the other thread. Thanks Rohit
8
2321
by: mk | last post by:
You probably suspect the answer, typically its 'yes' deadlock can occur in any multithreaded application. Even ones that employ static members. Commonly it occurs when more than one thread tries to lock a resource that another thread has already locked. A workaround is to use the Monitor object's TryEnter method, and pass a timeout value, if timeout occurs the method returns false. This pattern will save you no end of pain and...
15
10015
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried) 3-4 times and give up if after that it's still in deadlock. I'm very sure that many experienced people out there already deal with this issue somehow. Is there an alternative to it? Thanks for your comments and suggestions.
2
4703
by: | last post by:
I have a db2 V. 8.1 Fix Pack 13 installed, and i have too much problem with deadlock, maibe depends becouse i have a direct remote connection with a 56k modem. Someone know if depends to a particular parameter?
3
2015
by: bob_jeffcoat | last post by:
Hi, I'm trying to read the output and write the input of a process using its StandardOutput/Input and I'd really like to check if the process is waiting for input or whether it has output ready to be read. Is it possible? It seems like a fairly simple thing to try and do but most of the "read" functions I've tried seem to deadlock if there's nothing to read due the process waiting for output. It's rubbish! Even a simple "try for...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.