X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1FEB414B2820 for ; Mon, 9 Aug 2004 21:06:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07984-01 for ; Tue, 10 Aug 2004 00:05:58 +0000 (GMT) Received: from web13121.mail.yahoo.com (web13121.mail.yahoo.com [216.136.174.83]) by svr1.postgresql.org (Postfix) with SMTP id 6E27514B27FB for ; Mon, 9 Aug 2004 21:05:56 -0300 (ADT) Message-ID: <20040810000559.91562.qmail@web13121.mail.yahoo.com> Received: from [63.78.248.48] by web13121.mail.yahoo.com via HTTP; Mon, 09 Aug 2004 17:05:59 PDT Date: Mon, 9 Aug 2004 17:05:59 -0700 (PDT) From: Litao Wu Subject: insert waits for delete with trigger To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=HOT_NASTY X-Spam-Level: X-Archive-Number: 200408/116 X-Sequence-Number: 7752 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'