X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3848511F7BBA for ; Thu, 20 Apr 2006 14:21:26 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 required=5 tests=[none] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id v3UqCLbwe4tf for ; Thu, 20 Apr 2006 14:21:12 -0300 (ADT) X-Greylist: delayed 00:32:34.326235 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DCB9311F6D5A for ; Thu, 20 Apr 2006 14:21:10 -0300 (ADT) Received: from mx.sat.rackspace.com (mx.sat.rackspace.com [64.39.1.214]) by svr4.postgresql.org (Postfix) with ESMTP id 1D1945AF058 for ; Thu, 20 Apr 2006 16:48:36 +0000 (GMT) Received: from mail.rackspace.com (mail.rackspace.com [64.39.2.181]) by mx.sat.rackspace.com (8.13.6/8.13.6) with ESMTP id k3KGmXUg023264 for ; Thu, 20 Apr 2006 11:48:34 -0500 (envelope-from wreese@rackspace.com) Received: from [10.6.104.60] (office104-60.sat4.rackspace.com [10.6.104.60]) (authenticated bits=0) by mail.rackspace.com (8.13.1/8.13.1) with ESMTP id k3KGmXkN010637 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Thu, 20 Apr 2006 11:48:33 -0500 Mime-Version: 1.0 (Apple Message framework v749.3) Content-Transfer-Encoding: 7bit Message-Id: <9EAB2F2F-0BC2-4685-96A1-A29D7872D068@rackspace.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Will Reese Subject: Slow deletes in 8.1 when FKs are involved Date: Thu, 20 Apr 2006 11:48:36 -0500 X-Mailer: Apple Mail (2.749.3) X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='__CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0' X-Archive-Number: 200604/537 X-Sequence-Number: 18621 I'm preparing for an upgrade from PostgreSQL 7.4.5 to 8.1.3, and I noticed a potential performance issue. I have two servers, a dual proc Dell with raid 5 running PostgreSQL 7.4, and a quad proc Dell with a storage array running PostgreSQL 8.1. Both servers have identical postgresql.conf settings and were restored from the same 7.4 backup. Almost everything is faster on the 8.1 server (mostly due to hardware), except one thing...deletes from tables with foreign keys. I have table A with around 100,000 rows, that has foreign keys to around 50 other tables. Some of these other tables (table B, for example) have around 10 million rows. On the 7.4 server, I can delete a single row from a table A in well under a second (as expected). On the 8.1 server, it takes over a minute to delete. I tried all the usual stuff, recreating indexes, vacuum analyzing, explain analyze. Everything is identical between the systems. If I hit ctrl-c while the delete was running on 8.1, I repeatedly got the following message... db=# delete from "A" where "ID" in ('6'); Cancel request sent ERROR: canceling statement due to user request CONTEXT: SQL statement "SELECT 1 FROM ONLY "public"."B" x WHERE "A_ID" = $1 FOR SHARE OF x" It looks to me like the "SELECT ... FOR SHARE" functionality in 8.1 is the culprit. Has anyone else run into this issue? Will Reese -- http://blog.rezra.com