使用 Toad 实现 SQL 优化

       It is very easy for us to implement sql tuning by toad.  We need to do is just give complex sql statement to toad. The article
give you some examples to demonstrate how to tuning sql by toad for oracle.

 

1. Get execution plan
Editor  --> Explain plan current SQL  or CTRL + E
 使用 Toad 实现 SQL 优化_第1张图片

2. Get statistics/Auto Trace
Enable Auto Trace panel.

使用 Toad 实现 SQL 优化_第2张图片

or you can right click and choose auto trace to enable it in SQL editor blank.

使用 Toad 实现 SQL 优化_第3张图片

 

3. Get statistics after executed sql.
 使用 Toad 实现 SQL 优化_第4张图片

4. Tuning SQL

使用 Toad 实现 SQL 优化_第5张图片

Executed sql

 使用 Toad 实现 SQL 优化_第6张图片

Then current SQL will be executed and many alternative sql statement will be generated.

 

5. Compare result
 使用 Toad 实现 SQL 优化_第7张图片

使用 Toad 实现 SQL 优化_第8张图片

From above using where clause replace having clause is fine.

Actually SQL tuning tools is derived from Quest SQL optimizer. If you learn more please go through http://www.quest.com/sql-optimizer-for-oracle/

Although  SQL tuning optimizer help us a lot ,master SQL tuning we should have deep understand such like sql execution plan,
auto trace statistics, table join, index and so on.

The demo is based on Toad for Oracle 10.5.0.41

Author : Robinson Cheng

Blog: http://blog.csdn.net/robinson_0612

 

你可能感兴趣的:(JOIN,oracle,sql,table,tools,statistics)