From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | schen(at)graciousstyle(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: [ADMIN] how to find transaction associated with a lock |
Date: | 2004-07-22 22:37:21 |
Message-ID: | 13323.1090535841@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general pgsql-novice |
Si Chen <schen(at)graciousstyle(dot)com> writes:
> Do you think I'm looking down the wrong path?
I'd bet that the problem is contention for a row referenced by a foreign
key. When you insert a row that has a foreign key reference to another
table, we need to lock the referenced row to ensure it doesn't get
deleted until the inserting transaction commits. (Once you commit, your
inserted row is visible and it's then the responsibility of a deleting
transaction to notice the foreign-key violation. But until then, a
deleting transaction can't even *see* your row so we need another way.)
The real problem here is that we only have exclusive locks at the row
level, so the only way to do this is to take an exclusive lock, and that
means that transactions inserting references to the same referenced row
block each other. So I think your INSERT is waiting on commit of some
other transaction's INSERT that references the same foreign key row.
Fixing this is on the TODO list but I don't expect any solution in the
near future :-(
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Kirkwood | 2004-07-22 23:08:09 | Re: [HACKERS] Point in Time Recovery |
Previous Message | Tom Lane | 2004-07-22 22:30:20 | Re: Invalid page header |
From | Date | Subject | |
---|---|---|---|
Next Message | Steve | 2004-07-22 23:53:28 | Re: mirroring data on different drives? |
Previous Message | culley harrelson | 2004-07-22 21:58:05 | any benefit to preparing a sql function? |
From | Date | Subject | |
---|---|---|---|
Next Message | sql | 2004-07-23 13:56:49 | unique ID |
Previous Message | Si Chen | 2004-07-22 21:44:29 | Re: [ADMIN] how to find transaction associated with a lock |