checking the delete performance in the package [message #581974] |
Fri, 12 April 2013 05:27 |
grpatwari
Messages: 288 Registered: June 2008 Location: Hyderabad
|
Senior Member |
|
|
Hi,
I need to check the package performance and need to improve the package performance.
1. how to check the package performance(each and every statment in the package)?
2. In the pacakge using the delete statement to delete all records and observed that delete is taking long time to delete all the records in the table(Table records 7000000).This table is like staging table.Daily need to clean the data before inserting the data into it. what can I use instead of Delete.
Please advice.
|
|
|
|
Re: checking the delete performance in the package [message #582253 is a reply to message #581976] |
Tue, 16 April 2013 07:08 |
|
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
TKPROF is good tool. But if you don't know what TRUNCATE is then maybe TKPROF is not the first place to start. Also TKPROF requires access to the HOST machine running the database and since SOX, many companies restrict such access making TKPROF unavailable, or requiring cooperation with an overworked SYSDBA.
So for this particular problem, assuming you can modify the code, the easiest way to get timings is to simply put some instrumenation into your code. Here is an exampe:
begin
dbms_output.put_line('START TIME 1 = '||TO_CHAR(SYSDATE,'DD-MON-RRRR HH24:MI:SS'):
-- DO SQL#1 HERE
dbms_output.put_linE('END TIME = 1 '||to_char(sysdate,'dd-mon-rrrr hh24:mi:ss');
dbms_output.put_line('START TIME 2 = '||TO_CHAR(SYSDATE,'DD-MON-RRRR HH24:MI:SS'):
-- DO SQL#2 HERE
dbms_output.put_linE('END TIME = 2 '||to_char(sysdate,'dd-mon-rrrr hh24:mi:ss');
end;
/
As you see, very primitive but it is easy, anyone with access to the code can do it, works in every Oracle environment currently supported.
Once you graduate from doing your own simple instrumentation, you can move on to using other people's stuff.
If you have TOAD then you can get your SYSDBA to install and make available DBMS_PROFILER. TOAD makes it easy to use (not an endorsement, just an observation).
There is always Tom Kyte's RUNSTATS utility.
And of course Tanel Poder's Snapper.
Good luck.
|
|
|
|
|
|
|
|
Re: checking the delete performance in the package [message #582565 is a reply to message #582556] |
Fri, 19 April 2013 07:52 |
cookiemonster
Messages: 13961 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Considering it's a single delete statement, with no noticable wait events and no other code running, I suspect you're going to have to buy better hardware, or look at options like partitioning.
Others may have better ideas though.
I suggest you post the explain plan for the delete, along with the table structure and details of any indexes.
EDIT: typo
[Updated on: Fri, 19 April 2013 07:52] Report message to a moderator
|
|
|
Re: checking the delete performance in the package [message #582578 is a reply to message #582565] |
Fri, 19 April 2013 09:36 |
grpatwari
Messages: 288 Registered: June 2008 Location: Hyderabad
|
Senior Member |
|
|
We donot have any index other than primary key index. Please we have only table structure and dont have the explain plan.
CREATE TABLE ORDER_DIFFERENCE_COMMODITY
(COMMODITY_ID VARCHAR2(20 BYTE),
ORDER_NUMBER VARCHAR2(6 BYTE),
ORDER_OFFLINE_DATE DATE NOT NULL ,
DIFFERENCE_TYPE NUMBER,
PLANT_CODE VARCHAR2(1 BYTE)NOT NULL,
K_SPEC_BATCH_NO VARCHAR2(8 BYTE),
primary key(COMMODITY_ID, ORDER_NUMBER)
);
ALTER TABLE ORDER_DIFFERENCE_COMMODITY ADD FOREIGN KEY (COMMODITY_ID)
REFERENCES COMMODITY (COMMODITY_ID) ENABLE;
ALTER TABLE ORDER_DIFFERENCE_COMMODITY ADD FOREIGN KEY (PLANT_CODE)
REFERENCES SCS_PLANT (PLANT_CODE) ENABLE;
Please suggest.
|
|
|
|
Re: checking the delete performance in the package [message #582736 is a reply to message #582731] |
Mon, 22 April 2013 06:09 |
grpatwari
Messages: 288 Registered: June 2008 Location: Hyderabad
|
Senior Member |
|
|
Hi,
I hope delete statement is taking the time by checking the trace file.I have observed two following scenarios.I need to test the below scenarios once.
Observation:
Delete statement is doing full table scan (because at any cost need to delete full data from the table may be million of data)
Recommendations:
-----------------
1. If we create the bitmap index on plant_code then it is taking ROWID index scan and then use the index hint on delete statement.
2. If we create the normal index on plant_code then it is taking range scan then use the index hint on delete statement.
Please advice if I am going wrong way.
|
|
|
|
|