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

Home -> Community -> Usenet -> c.d.o.server -> How do I speed this up?

How do I speed this up?

From: Mike Heden <mheden_at_bigfoot.com>
Date: 6 Dec 2002 07:43:12 -0800
Message-ID: <53b3de4.0212060743.56c83fc4@posting.google.com>


I have two tables which use a common unique key.

I want to delete a number of rows from table a where the unique key tablea.uniquekey is not present in table b as tableb.uniquekey.

In most cases the number of rows in tablea and tableb is roughly equal.

I've used:-

delete from tablea where tablea.uniquekey not in (select tableb.uniquekey from tableb)

This works OK for small numbers of rows, but the time to execute the query is a function of the product of the numbers of rows in the two tables. In practice if tablea and b copntain a couple of thousand rows the execution time is 5 seconds. However this rises to 240 seconds where the rowcount is around 17,000. For larger rowcounts the execution time quickly becomes unacceptable.

What's the quickest alternative way to achieve this? I'm using Oracle 8.1.7

Thanks,

Mike Received on Fri Dec 06 2002 - 09:43:12 CST

Original text of this message

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