Re: High cost of ... where ... not in (select ...)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aaron Turner <synfinatic(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: High cost of ... where ... not in (select ...)
Date: 2009-06-17 04:06:18
Message-ID: 14283.1245211578@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Aaron Turner <synfinatic(at)gmail(dot)com> writes:
> I know the costs are just relative, but I assumed
> cost=19229.08..29478.99 isn't 5 minutes of effort even on crappy
> hardware.

Very likely the bulk of the time is spent in the DELETE work proper,
not in the query to find the rows to be deleted. In particular I wonder
if you have an unindexed foreign key referencing this table ...

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2009-06-17 04:59:13 Re: Yet another slow nested loop
Previous Message Bryce Ewing 2009-06-17 03:30:03 Index Scan taking long time