NOT IN query issues

From: "Booth, Robert" <Robert_Booth(at)intuit(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: NOT IN query issues
Date: 2002-05-07 20:56:28
Message-ID: 419D2EB7B461D411A53B00508B69181D06232405@sdex02.sd.intuit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to run a DELETE query using NOT IN and it's causing me some
problems.

Here is the query that I want to run:

delete from sharinfo where file__no not in (select file__no from
allforms);

When I explain this I get:

Seq Scan on sharinfo (cost=0.00..2225204.88 rows=5239 width=6)
SubPlan
-> Seq Scan on allforms (cost=0.00..424.69 rows=8669 width=12)

Which while a very large number does seem to work. But when I run the query
nothing appears to happen, I've left this query running for hours with no
response back. Is there a better way to run a query like this (deleting all
rows that don't appear in a second table)?

Thanks,
Rob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message lloyd 2002-05-07 21:21:10 JDBC - escaping quotes?
Previous Message Jason Earl 2002-05-07 18:45:44 Re: Contrib reindex script: