From: | Litao Wu <litaowu(at)yahoo(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | insert waits for delete with trigger |
Date: | 2004-08-10 00:05:59 |
Message-ID: | 20040810000559.91562.qmail@web13121.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi all,
We have table q_20040805 and a delete trigger on
it. The delete trigger is:
update table q_summary set count=count-1...
When we delete from q_20040805, we also insert into
related info q_process within the same
transaction. There is a PK on q_process, but no
trigger on it. No FK on either of the 3 tables.
Here is info from pg_lock:
relname | pid | mode |
granted | current_query
-------------------+-------+------------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
q_process | 14643 | RowExclusiveLock | t |
DELETE FROM q_20040805 WHERE domain_id='20237906' AND
module='spam'
q_summary | 14643 | RowExclusiveLock | t |
DELETE FROM q_20040805 WHERE domain_id='20237906' AND
module='spam'
q_20040805 | 14643 | RowExclusiveLock | t |
DELETE FROM q_20040805 WHERE domain_id='20237906' AND
module='spam'
q_process | 18951 | RowExclusiveLock | t |
INSERT INTO q_process (...) SELECT ... FROM q_20040805
WHERE domain_id='20237906' AND module='spam'
From ps command, it is easy to see another
insert is waiting:
ps -elfww|grep 18951
040 S postgres 18951 870 0 69 0 - 81274
semtim 16:34 ? 00:00:00 postgres: postgres mxl
xxx.xxx.x.xxx:49986 INSERT waiting
ps -elfww|grep 14643
040 S postgres 14643 870 79 70 0 - 81816
semtim 15:56 ? 00:44:02 postgres: postgres mxl
xxx.xxx.x.xxx:47236 DELETE
I do not understand why process 18951 (insert)
is waiting (subqery SELECT of INSERT INTO
is not a problem as I know)
PG version is: 7.3.2
Can someone explain?
Thanks,
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-08-10 00:31:43 | Re: insert waits for delete with trigger |
Previous Message | Bill Montgomery | 2004-08-09 20:08:40 | Re: Help specifying new machine |