473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Process locked in INSERT: how to debug?

Hello,

What is the best method to debug a database that *sometimes* gets locked
in the INSERT mode? ('ps -afx | grep postgres' shows me a process that
is freezed in INSERT mode.)

Thanks

Philippe

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #1
1 1745
Hi Philippe,

I can't answer your actual question, but just a hint: postgres is
deadlock-prone on inserts into tables referencing other tables via
foreign keys. This is a known limitation of postgres, it places an
exclusive lock on the referenced rows. For details search the archives
for "foreign key deadlock", there's plenty of discussions about it.
So my personal suspect nr. 1. would be the foreign keys.
If that's the problem, you can solve it in a number of ways:
- serialize your inserts, as the problem appears only for concurrent
inserts - this is probably the least viable option;
- make sure you order your inserts so that they insert the rows in the
same order of referenced parent rows (damn hard to do if you have many
foreign keys);
- be prepared to retry each transaction involving the inserts (this is
actually the best way to do it with postgres, at least in pre-8.0
versions, as it also solves the problem of "one failed SQL rolls back
the whole transaction");
- if you use 8.0 then you could use the new save point feature to retry
just the last failed insert, but I have no idea if that's not bundled
with some performance penalties (actually I didn't try at all 8.0, so I
just suppose it would work);
- use a patched postgres version which does not have the foreign key
deadlock problem, but it also do not have 100% referential integrity
guarrantied for foreign key constraints. I think you can find the patch
somewhere referenced in a past mail;

HTH,
Csaba.
On Mon, 2004-08-30 at 14:26, Philippe Lang wrote:
Hello,

What is the best method to debug a database that *sometimes* gets locked
in the INSERT mode? ('ps -afx | grep postgres' shows me a process that
is freezed in INSERT mode.)

Thanks

Philippe

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2

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

Similar topics

4
by: Earth Worm Jim | last post by:
I am using VS.Net 2003 on Windows 2003 Server (standard edition) and I am getting "The process cannot access the file because it is being used by another process" on DLL's in a VS.Net solution. ...
0
by: Keith | last post by:
Hi. I've developed an ASP.NET web service that uses an xml file to store configuration settings. I'm creating a cache dependency based on the xml file and its schema, like this... XmlDocument...
3
by: rao | last post by:
Hi All, I am generating temporary xml files to bind it to tree view control. A unique xml file is generated for each user. I generating these files Using streamwriter class. Later when I try to...
3
by: Reza Solouki | last post by:
Hello, I ran the Microsoft Baseline Security analyzer 1.2 on my developement machine, then as one of the requests. Also updated the machine 1.1 Framework with service pack 1. Now everytime I...
1
by: ABCL | last post by:
Hi All, I am working on the situation where 2 different Process/Application(.net) tries to open file at the same time....Or one process is updating the file and another process tries to access...
13
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
3
by: eugenet | last post by:
Hello, This is probably a newbie question. In my C# program, when I try to delete a file, I get an exception that the file is locked by another process. I would like to terminate the process...
6
by: andre.naess | last post by:
Hi all I'm currently having some issues with a process getting deadlocked. The problem is that the only way I can seem to find information about where it deadlocks is by making a wild guess,...
9
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.