Re: [GENERAL] Tracking down deadlocks

2004-06-17 Thread Csaba Nagy
Ben, My personal solution is to patch the postgres sources so the foreign key check does NOT lock the parent record. This has the disadvantage that in some situations the foreign key semantics are not guarrantied, but for my application works just fine. I think there was a patch posted to do exact

Re: [GENERAL] Tracking down deadlocks

2004-06-16 Thread Ben
So is everybody simply accepting the chance of deadlocks, thanks to their foreign keys? Given what I know about why this problem exists, it doesn't seem to have an easy solution but from my naive perspective it seems like something that we shouldn't have to just live with, either. On Jun 1

Re: [GENERAL] Tracking down deadlocks

2004-06-16 Thread Joshua D. Drake
Hello, Deferred checks can greatly reduce the deadlock chance because of the timing of the foreign key check. I won't say it can eliminate them, and I don't think anyone here would suggest that you don't use Foreign keys. Sincerely, Joshua D. Drake Ben wrote: Thanks for the quick reply (and summa

Re: [GENERAL] Tracking down deadlocks

2004-06-16 Thread Ben
Thanks for the quick reply (and summary!). According to the messages I've found on the list, basically the answer seems to be, "don't do this." On the other hand, pretty much every message on the subject is pre-7.4. There is some mention of using deferred foreign keys to reduce the chance for a

Re: [GENERAL] Tracking down deadlocks

2004-06-16 Thread Tom Lane
Ben <[EMAIL PROTECTED]> writes: > I'm doing a bunch of data mining against a postgres database and have > run into an interesting problem with deadlocks. The problem is, > postgres is detecting them and then wacking the offending process, and > I can't figure out what's causing them. The proces

Re: [GENERAL] Tracking down deadlocks

2004-06-16 Thread Csaba Nagy
Hi Ben, Check this mailing list for "foreign keys" and "deadlock". Short info: Postgres exclusively locks the referenced records of a foreign key relationship when the child record is updated, so multiple runs (in different transactions) of one insert query could cause deadlock if they update row

[GENERAL] Tracking down deadlocks

2004-06-16 Thread Ben
I'm doing a bunch of data mining against a postgres database and have run into an interesting problem with deadlocks. The problem is, postgres is detecting them and then wacking the offending process, and I can't figure out what's causing them. I have a ton of select queries (but none for updat