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: Update and Delete takes too long, Help...

Re: Update and Delete takes too long, Help...

From: <oratune_at_aol.com>
Date: Fri, 15 Sep 2000 21:54:13 GMT
Message-ID: <8pu5ps$rpr$1@nnrp1.deja.com>

This should allow the index to be used for the delete.

> SET TRANSACTION USE ROLLBACK SEGMENT RB1;
> DELETE FROM DivisionEOD.Comdhis
> WHERE LoanNum || OfficeNum || CliNum || Date_R IN
> (SELECT DISTINCT LoanNum || OfficeNum || CliNum || Date_R
> FROM temp_Comdhis
> WHERE DATE_R BETWEEN
> TO_DATE('01'||TO_CHAR(Add_MONTHS(sysdate,-1),'MMYYYY'),'DDMMYYYY') AND
> Add_MONTHS(sysdate,1)
> AND temp_Comdhis.loannum = divisioneod.Comdhis.loannum
> AND temp_Comdhis.OfficeNum =
 divisioneod.Comdhis.OfficeNum
> AND temp_Comdhis.clinum = divisioneod.Comdhis.clinum
> AND temp_Comdhis.Date_R = divisioneod.Comdhis.Date_R);
> COMMIT;
>

Again, the Achiles heel of this is also the Date_R column, for the same reason. Use the same hint syntax in the delete to utilize the index for this transaction and the one following.

> SET TRANSACTION USE ROLLBACK SEGMENT RB1;
> INSERT INTO DivisionEOD.Comdhis
> (SELECT *
> FROM Temp_Comdhis
> WHERE OfficeNum Is Not Null
> AND DATE_R BETWEEN
> TO_DATE('01'||TO_CHAR(Add_MONTHS(sysdate,-1),'MMYYYY'),'DDMMYYYY') AND
> Add_MONTHS(sysdate,1));
> COMMIT;
>
> Any help on this would be greatly appreciated. If you need any more
> information please let me know and I will
> provide it....
>
> S
>
>

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Sep 15 2000 - 16:54:13 CDT

Original text of this message

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