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 -> Re: Slow insert

Re: Slow insert

From: Eric Byrnes <ericbyrnes_at_sprintmail.com.NOSPAM>
Date: Thu, 10 Dec 1998 20:37:41 -0500
Message-ID: <36707764.1C0EF18B@sprintmail.com.NOSPAM>


I've run into similar situations. The IN clause is requeried for every row inserted into Table A, generating full table or potentially large index range scans on Table A for each inserted row.
Try this:

insert into TABLEA
select * from TABLEB
where not exists (select 'X' from TABLEA

   where KEY = TABLEB.KEY);

The EXISTS clause will use the index and should speed things up considerably.

HTH,
   Eric

Lito Dizon wrote:

> Why is this so slow? Slow meaning 10 hours. Ans the
> further it gets, the slower it gets.
>
> insert into TABLEA
> select * from TABLEB
> where KEY not in (select KEY from TABLEA )
>
> Both tables are indexed on KEY. TABLEA has 9000 rows
> while TABLE B has 12000 rows.
Received on Thu Dec 10 1998 - 19:37:41 CST

Original text of this message

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