Re: bulk DELETE speed

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: "Kuhn, Dylan K " "(4520500D)" <Dylan(dot)Kuhn(at)navy(dot)mil>
Cc: marie(dot)tuite(at)edisonaffiliates(dot)com, pgsql-admin(at)postgresql(dot)org
Subject: Re: bulk DELETE speed
Date: 2003-05-19 19:45:38
Message-ID: 1053373538.23813.46.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Browse pgsql-admin by date

  From Date Subject
Next Message Kuhn, Dylan K (4520500D) 2003-05-19 22:36:28 Re: Howto Setup a good PostgreSQL Server
Previous Message Stefan Sturm 2003-05-19 15:16:16 Howto Setup a good PostgreSQL Server