delete no of records [message #469161] |
Tue, 03 August 2010 10:25 |
prashant_ora
Messages: 196 Registered: July 2010
|
Senior Member |
|
|
I am using one script to delete the records from a table, its taking 1hr to delete.
declare
cursor c1 is select ownerid,ownertype from nightly_metric_projects
;
v1 c1%rowtype;
open c1;
loop
fetch c1 into v1;
exit when c1%notfound;
DELETE FROM DGT_ITEMEFFORTDATA WHERE OWNERTYPE = c1.OWNERTYPE
AND OWNERID = c1.OWNERID;
end loop;
close c1;
commit;
nightly_metric_projects--1200 records
DGT_ITEMEFFORTDATA--13200000
CAN WE REDUCE THE TIME.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: delete no of records [message #469222 is a reply to message #469168] |
Tue, 03 August 2010 23:58 |
prashant_ora
Messages: 196 Registered: July 2010
|
Senior Member |
|
|
This is the plan
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost
--------------------------------------------------------------------------------
| 0 | DELETE STATEMENT | | 9276K| 433M| 2795
| 1 | DELETE | DGT_ITEMEFFORTDATA | | |
| 2 | NESTED LOOPS | | 9276K| 433M| 2795
| 3 | SORT UNIQUE | | 1296 | 11664 |
| 4 | TABLE ACCESS FULL| NIGHTLY_METRIC_PROJECTS | 1296 | 11664 |
|* 5 | INDEX RANGE SCAN | IDX_DGT_ITEMEFFORTDATA_OWN | 7158 | 279K| 4
--------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
5 - access("OWNERTYPE"="OWNERTYPE" AND "OWNERID"="OWNERID")
Note
-----
|
|
|
|