Is there any article/link available where I can find examples of SQL tuning(Oracle). It would great if it is explain with example. I need something like existing query, statstics, plan and then suggested query/recommendation and new plan.
I found couple of really good links on google:
However I m looking for real time examples with above mentioned details, which are missing in these articles.
I hope I m not asking for too much. :-)
There are few shortcuts - for best results:
This book explains how the optimizer makes its decisions.
I'm not sure of the licensing implications for personal use, but also learn how to use the dbms_sqltune package - in cases where it can find an improved plan over the normal optimizer path it will generate a report showing the differences. You can pick up a lot by looking at this information.
Writing better SQL: Dan Tow's "Tuning SQL" by O'Reilly's a very good cross-platform SQL tuning guide. It's not a short read, but it does cover some pretty hairy examples and shows you how to tune your queries. There's no FAST=TRUE option in Oracle; if there were, it'd be hidden and you wouldn't be allowed to change it. His web site's at http://singingsql.com.
Tuning by Response Time: Cary Millsap's focused heavily on using the Oracle wait interface and queuing theory to tune SQL and systems over the last 20 years or thereabouts; both his current company ( http://method-r.com ) and his previous one ( http://hotsos.com ) have a number of useful resources.
Tuning via Optimizer Statistics: Wolfgang Breitling at http://centrexcc.com has done some excellent work in demonstrating tuning by cardinality feedback to demonstrate that if the SQL's good and there's too much load, the problem can be that you're lying to Oracle (or Oracle's making unsafe deductions) about the nature of the data. He then shows you how to fix it.
All of these are valuable. All of these alone are incomplete.
And I second the recommendation of Jonathan Lewis' fine work; he's got a pretty fair tuning blog over at http://jonathanlewis.wordpress.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With