This article shows an easy way to determine, whether your Oracle Database Performance Tuning task has been successful – or not. In the end, it boils down to “The objective for tuning an Oracle system could be stated as reducing the time that users spend in performing some action on the database, or simply reducing DB time.” as the Online Documentation says. Best proof would be a confirmation from the end users that run time got reduced; second best is a proof of reduced DB time, which is discussed here.
A tuning task should always end with such a proof; your gut feeling or high confidence is not sufficient – or as I like to say: “Don’t believe it, test it!” :-)
The demo scenario: With an Oracle Enterprise Edition version 220.127.116.11, an application uses these commands to delete rows:
SQL> create table t as select * from dual where 1=2 -- see * below ;Table created. SQL> begin for i in 1..100000 loop execute immediate 'delete from t where dummy='||to_char(i); end loop; end; /
I am pretty sure that this code is not optimal, because it uses Literals instead of Bind Variables where it is not appropriate. Before I implement an improved version of the code, I take a Baseline with Automatic Workload Repository (AWR) snapshots. On my demo system, snapshots are taken every ten minutes:
SQL> begin for i in 1..100000 loop delete from t where dummy=to_char(i); end loop; end; /
The EM Performance page show no peak during the next 10 minutes which represent my comparison period after the tuning task:
The important (especially for OLTP systems) Library Cache hit ratio is now very good. A very convenient way to compare the two snapshot ranges is the ‘AWR Compare Periods’ feature in EM (or awrddrpt.sql) , which shows us instructively:
This kind of proof (less DB time) can be used also in cases where the reduction of run time for a single statement is not so obvious as in my example. If 1000 users had done each 100 deletes, they would have seen not much difference in run time each – but the parse time summarizes and impacts overall performance similar as seen here. If you would like to see the three original AWR reports were I took the screen shots above from, they are here as PDFs
Conclusion: You will – and should – be able to prove the effectiveness of your Oracle Database Tuning task with a reduction of DB time from an AWR report comparison. After all, you don’t want to waste your efforts, do you? :-)
Addendum: This posting was published in the Oracle University EMEA Newsletter May 2013
* My apologies to anyone who tried the first code without the addendum where1=2 – it doesn’t work. Apparently, I have deleted the one row in the table during my preparation of the demo.