Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Slow insert
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