Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Faster non-existence check (newbie)

Re: Faster non-existence check (newbie)

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 10 Dec 1999 09:06:56 -0000
Message-ID: <944816939.7965.0.nnrp-11.9e984b29@news.demon.co.uk>

select {parent key columns} from parent_table MINUS
select {matching child column} from child_table ;

The correlated existence test already
mentioned by others is usually the
fastest, but the above set-wise operation can sometimes be faster.

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

Paavo Helde wrote in message <384CE55C.557EED28_at_hexagon.fi.tartu.ee>...
>
>There are two Oracle tables in 1:N relation, both about 50,000 records.
>I have to find the records in the parent table for which there is no
>record
>in the child table. I am told that subqueries are in general the fastest
>way
>in Oracle. However, it seems to me that query
>
>SELECT COUNT(*) FROM parent WHERE ident NOT IN (SELECT parentref FROM
>child);
>
>is unacceptably slow (actually I have not yet succeeded to wait the
>completion
>of it). The result should be about 10,000 records. Other queries not
>involving "NOT IN" seem to work ok. I have done a lot of programming in
>FoxPro
>and there a query like this could take a couple of seconds at most.
>
>Is there any way to speed up the query or to check if there is something
>wrong
>with the server settings?
>
>TIA
>Paavo
Received on Fri Dec 10 1999 - 03:06:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US