"Clay Luther" <claycle@cisco.com> writes:
> ccm=# explain delete from numplan where pkid in (select numplan.pkid from numplan left outer join pilothuntgroup on
numplan.pkid=pilothuntgroup.fknumplanleft outer join devicenumplanmap on numplan.pkid = devicenumplanmap.fknumplan
wherenumplan.tkpatternusage=2 and pilothuntgroup.fknumplan is null and devicenumplanmap.fknumplan is null);
The left join/is null thingies look like a workaround for our pre-7.4
lack of performance with NOT IN queries. Have you tried expressing
this more straightforwardly with NOT IN?
Also, what sort_mem setting are you using?
regards, tom lane