Re: Help with large delete - Mailing list pgsql-general

From Tom Lane
Subject Re: Help with large delete
Date
Msg-id 1939729.1650123237@sss.pgh.pa.us
Whole thread Raw
In response to Help with large delete  (Perry Smith <pedz@easesoftware.com>)
Responses Re: ***SPAM*** Re: Help with large delete  (Perry Smith <pedz@easesoftware.com>)
Re: Help with large delete  (Perry Smith <pedz@easesoftware.com>)
List pgsql-general
Perry Smith <pedz@easesoftware.com> writes:
> Currently I have one table that mimics a file system.  Each entry has a parent_id and a base name where parent_id is
anid in the table that must exist in the table or be null with cascade on delete. 
> I’ve started a delete of a root entry with about 300,000 descendants.  The table currently has about 22M entries and
I’madding about 1600 entries per minute still.  Eventually there will not be massive amounts of entries being added and
thetable will be mostly static. 

The most obvious question is do you have an index on the referencing
column.  PG doesn't require one to exist to create an FK; but if you
don't, deletes of referenced rows had better be uninteresting to you
performance-wise, because each one will cause a seqscan.

            regards, tom lane



pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: Help with large delete
Next
From: Adrian Klaver
Date:
Subject: Re: Require details that can we see the password history to a User account in PostgreSQL Database.