Re: when is a DELETE FK trigger planned? - Mailing list pgsql-performance

From Tom Lane
Subject Re: when is a DELETE FK trigger planned?
Date
Msg-id 19945.1203989110@sss.pgh.pa.us
Whole thread Raw
In response to when is a DELETE FK trigger planned?  (Andrew Lazarus <andrew@pillette.com>)
Responses Re: when is a DELETE FK trigger planned?  (Andrew Lazarus <andrew@pillette.com>)
List pgsql-performance
Andrew Lazarus <andrew@pillette.com> writes:
> I have a cascading delete trigger that is obviously using a seqscan.
> (Explain analyze shows that trigger as taking over 1000s while all
> other triggers are <1s. The value in test delete didn't even appear in
> this child table, so an index scan would have been almost instant.)

> If I do
> DELETE FROM child_table WHERE fkey = value;
> I get an index scan. Why doesn't the trigger do that, and how can I
> force it to re-plan?

That would depend on what PG version you're using.

However, starting a fresh connection should get you a new trigger
function plan in any case.

            regards, tom lane

pgsql-performance by date:

Previous
From: Sean Leach
Date:
Subject: Re: Weird issue with planner choosing seq scan
Next
From: Dimitri Fontaine
Date:
Subject: multi-threaded pgloader needs your tests