Re: Deleting millions of rows - Mailing list pgsql-performance

From Tom Lane
Subject Re: Deleting millions of rows
Date
Msg-id 15177.1233695849@sss.pgh.pa.us
Whole thread Raw
In response to Re: Deleting millions of rows  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Deleting millions of rows
List pgsql-performance
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Robert Haas escribi�:
>> Have you ever given any thought to whether it would be possible to
>> implement referential integrity constraints with statement-level
>> triggers instead of row-level triggers?

> Well, one reason we haven't discussed this is because our per-statement
> triggers are too primitive yet -- we don't have access to the list of
> acted-upon tuples.  As soon as we have that we can start discussing this
> optimization.

I think the point is that at some number of tuples it's better to forget
about per-row tests at all, and instead perform the same whole-table
join that would be used to validate the FK from scratch.  The mechanism
we lack is not one to pass the row list to a statement trigger, but one
to smoothly segue from growing a list of per-row entries to dropping
that list and queueing one instance of a statement trigger instead.

            regards, tom lane

pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: SSD performance
Next
From: Andrew Lazarus
Date:
Subject: Re: Deleting millions of rows