Delete statement being running for over 2hrs [message #510297] |
Fri, 03 June 2011 08:48 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
youngb912
Messages: 56 Registered: October 2007 Location: New York
|
Member |
|
|
Hello Team,
I am running the following delete query and it has been running for over 2hrs:
delete from dw.ACCOUNT_FACT
where rowid in
(select rowid from DW.ACCOUNT_FACT
minus
select max(rowid) from DW.ACCOUNT_FACT
group by CRTORD_FIPS_CD, LAST_PAYMENT_DT, ORDER_NUM, ACCOUNT_TYP_ID, MEMBER_ID, CASE_NUM, MONTHLY_SOA_AMT, ACCOUNT_CLOSED_DT, ACCOUNT_CREATION_DT, SOA_FREQ_CD, FED_TAX_CERT_IND, ACCOUNT_BALANCE_AMT, STATE_TAX_CERT_CD, ACCOUNT_BALANCE_UPDATE_DT, ACCOUNT_STATUS_CD);
commit;
Here is the explan plain result:
explain plan for delete from dw.ACCOUNT_FACT
where rowid in
(select rowid from DW.ACCOUNT_FACT
minus
select max(rowid) from DW.ACCOUNT_FACT
group by CRTORD_FIPS_CD, LAST_PAYMENT_DT, ORDER_NUM, ACCOUNT_TYP_ID, MEMBER_ID, CASE_NUM, MONTHLY_SOA_AMT, ACCOUNT_CLOSED_DT, ACCOUNT_CREATION_DT, SOA_FREQ_CD, FED_TAX_CERT_IND, ACCOUNT_BALANCE_AMT, STATE_TAX_CERT_CD, ACCOUNT_BALANCE_UPDATE_DT, ACCOUNT_STATUS_CD);
commit;
select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 611392786
----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------------------
| 0 | DELETE STATEMENT | | 2604G| 260T| | 9018K (91)| 30:03:37 |
| 1 | DELETE | ACCOUNT_FACT | | | | | |
|* 2 | HASH JOIN | | 2604G| 260T| 369M| 9018K (91)| 30:03:37 |
| 3 | VIEW | VW_NSO_1 | 16M| 184M| | 745K (1)| 02:29:12 |
| 4 | MINUS | | | | | | |
| 5 | SORT UNIQUE | | 16M| 184M| 309M| | |
| 6 | BITMAP CONVERSION TO ROWIDS | | 16M| 184M| | 20 (0)| 00:00:01 |
| 7 | BITMAP INDEX FULL SCAN | IDX_AC_FED_TAX_CERT_IND | | | | | |
| 8 | SORT UNIQUE | | 16M| 1354M| 1939M| | |
| 9 | SORT GROUP BY | | 16M| 1354M| 1939M| 672K (1)| 02:14:27 |
| 10 | TABLE ACCESS BY INDEX ROWID | ACCOUNT_FACT | 16M| 1354M| | 18923 (3)| 00:03:48 |
| 11 | BITMAP CONVERSION TO ROWIDS| | | | | | |
| 12 | BITMAP INDEX FULL SCAN | IDX_AC_FED_TAX_CERT_IND | | | | | |
| 13 | TABLE ACCESS BY INDEX ROWID | ACCOUNT_FACT | 16M| 1508M| | 20 (0)| 00:00:01 |
| 14 | BITMAP CONVERSION TO ROWIDS | | | | | | |
| 15 | BITMAP INDEX FULL SCAN | IDX_AC_FED_TAX_CERT_IND | | | | | |
----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access(ROWID="$kkqu_col_1")
I have all constraints disabled. How do I make this delete finish faster? We're trying to remove duplicates from this table using the criteria giving in the statement.
Thanks
|
|
|
|
|
|
Re: Delete statement being running for over 2hrs [message #510320 is a reply to message #510310] |
Fri, 03 June 2011 10:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
youngb912
Messages: 56 Registered: October 2007 Location: New York
|
Member |
|
|
Sorry I misunderstood the request:
SELECT COUNT(*) from dw.ACCOUNT_FACT
where rowid in
(select rowid from DW.ACCOUNT_FACT
minus
select max(rowid) from DW.ACCOUNT_FACT
group by CRTORD_FIPS_CD, LAST_PAYMENT_DT, ORDER_NUM, ACCOUNT_TYP_ID, MEMBER_ID, CASE_NUM, MONTHLY_SOA_AMT, ACCOUNT_CLOSED_DT, ACCOUNT_CREATION_DT, SOA_FREQ_CD, FED_TAX_CERT_IND, ACCOUNT_BALANCE_AMT, STATE_TAX_CERT_CD, ACCOUNT_BALANCE_UPDATE_DT, ACCOUNT_STATUS_CD);
COUNT(*)
----------
3968364
1 row selected.
|
|
|
|
Re: Delete statement being running for over 2hrs [message #510325 is a reply to message #510321] |
Fri, 03 June 2011 11:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
youngb912
Messages: 56 Registered: October 2007 Location: New York
|
Member |
|
|
Is there a way to tell the progression of the delete or determine if delete is actually happening? In addition, is there a way to determine how long it will take?
I am running the delete on my laptop at work and I need to disconnect. I have an Oracle training by 4pm today. Thanks
|
|
|
|
|
|
|
|
|
Re: Delete statement being running for over 2hrs [message #510503 is a reply to message #510451] |
Mon, 06 June 2011 04:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Roachcoach wrote on Mon, 06 June 2011 08:09If you disconnect and were running the session locally on the laptop, the delete will need to start again from scratch.
Plus oracle will have to rollback everything it did up to that point, which will also take a while.
|
|
|
Re: Delete statement being running for over 2hrs [message #510634 is a reply to message #510297] |
Mon, 06 June 2011 21:44 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
hkchital
Messages: 128 Registered: September 2008 Location: Singapore
|
Senior Member |
|
|
What is this supposed to delete ?
All those rows where the GROUP BY column list is duplicated ?
What if some values are triplicated ? You'd still have duplicates after the delete.
I doubt if this table is 500TB in size. The explain plan shows that Oracle expects to delete 2,604Billion rows with a total size of 260TB. I would ask if the statistics are correct.
Have you considered using Parallel DML ?
{code}
ALTER SESSION ENABLE PARALLEL_DML;
DELETE /*+ PARALLEL */ ...
{code}
Hemant K Chitale
|
|
|
Re: Delete statement being running for over 2hrs [message #510637 is a reply to message #510634] |
Mon, 06 June 2011 22:23 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
youngb912
Messages: 56 Registered: October 2007 Location: New York
|
Member |
|
|
This table is only 1.7 Gig with about 18 million rows. You're correct...some of the columns contain more than 2 duplicates. Would you please let me know the best way to script the delete using those columns? I have been trying other methods with no success.
Thanks
|
|
|
|