Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HELP- Insert/Update Sloooow
<hliji_at_yahoo.com> wrote in message
news:1104933195.607291.274660_at_z14g2000cwz.googlegroups.com...
> Hi,
>
> I have 2 tables, working table W and the history table H.
> W has 2 million rows. I need to compare a common column C
> in both tables. For a record in W, R, if R.C has a value that
> equals to a record's H.C in H, then update that record in H.
> Otherwise, R is considered a new record for H and will be inserted
> into H.
>
> I used a cursor for loop for W. But the operation was extreamly
> slow. Any other solutions?
>
> Thanks in advance.
>
> MK
>
Have you checked with sqltrace/tkprof where the bottleneck is ? Do you have any indexes on the table ? Maybe for each comparison, a full-table scan is done ...
Matthias Received on Wed Jan 05 2005 - 12:32:18 CST