X-Original-To: pgsql-admin@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 95DB09258E5 for ; Mon, 19 May 2003 18:05:51 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 32251-08 for ; Mon, 19 May 2003 18:05:20 -0400 (EDT) Received: from localhost.localdomain (unknown [65.217.53.66]) by developer.postgresql.org (Postfix) with ESMTP id 5CF81925AB0 for ; Mon, 19 May 2003 15:45:50 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h4JKXaM3019924; Mon, 19 May 2003 16:33:36 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h4JJjdL25053; Mon, 19 May 2003 15:45:39 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 2YCPZQMT; Mon, 19 May 2003 15:45:37 -0400 Subject: Re: bulk DELETE speed From: Robert Treat To: "Kuhn, Dylan K " "(4520500D)" Cc: marie.tuite@edisonaffiliates.com, pgsql-admin@postgresql.org In-Reply-To: <78ED1F30F0D85B4698FBD6CF2A5AC8F5A576D5@NAWECHLKEX01VA.nadsuswe.nads.navy.mi l> References: <78ED1F30F0D85B4698FBD6CF2A5AC8F5A576D5@NAWECHLKEX01VA.nadsuswe.nads.navy.mi l> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 19 May 2003 15:45:38 -0400 Message-Id: <1053373538.23813.46.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/255 X-Sequence-Number: 8817 On Fri, 2003-05-16 at 15:07, Kuhn, Dylan K (4520500D) wrote: > I'm not deleting all the records, but I could maybe copy the ones I want > to keep into a temporary table. It looks like I have to somehow disable > the foreign key constraints that reference the table before truncating > it. Is this possible? > Syntax for 7.2.x is: UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" = 'mytable'; UPDATE pg_class SET reltriggers = (SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) WHERE relname = 'mytable'; I think it's the same in 7.3.x, but double check before using it. Robert Treat