SQL tuning in Oracle [closed]

旧街凉风 提交于 2020-01-01 06:42:25

问题


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:

  1. http://www.dba-oracle.com/art_sql_tune.htm
  2. http://www.orafaq.com/tuningguide/

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. :-)


回答1:


There are few shortcuts - for best results:

  1. Purchase a copy of "Cost-Based Oracle Fundamentals" by Jonathan Lewis
  2. Set up a local Oracle database over which you have full control
  3. Work through his examples

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.




回答2:


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




回答3:


You can also try using Oracle SQL tuning tool, located here https://sql-tuning.com




回答4:


http://philip.greenspun.com/sql/tuning.html

Sql tuning is not easy because it depends on many factors. There is no universal method. Sometimes, just add an index or hint, sometimes need to change the structure.



来源:https://stackoverflow.com/questions/3706750/sql-tuning-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!