Hint的语法可以查联机文档的SQL reference
SELECT /*+ First_rows */ * FROM hr.employees;
SELECT /*+ ALL_ROWS */ * FROM hr.employees;
上面两个hint对应最佳response time与最佳thoughout。
Optimizer Plan Stability(稳定性)
同一个SQL语句在不同版本不同环境下,可能执行计划就不
同,从而导致性能不同。
Users can stabilize execution plans,to force
applications to use a desired SQL access path.
用户能强制稳定地使用某个执行计划。
A consistent execution path is thereby maintained
through database changes.
This is done by creating a stored outline consisting
of hints.(过时了,9i开始用了sql plan management代替
了)
The OPTIMIZER_FEATURES_ENABLE parameter enables the
optimizer to retain CBO features of previous
versions.
指定某个过去的版本号,就可以用过去版本的特性来运行这
个SQL语句。
alter system set OPTIMIZER_FEATURES_ENABLE=8.1.5
scope=spfile;
SQL Plan Management(9i开始取代了Stored outlines)
Diagnostic Tools诊断工具
*Statspack综合性报告
*EXPLAIN PLAN
*SQL trace and TKPROF(TKPROF是个解读trace文件的工具
)
*SQL*Plus autotrace feature
*Oracle SQL Analyze(OEM中的功能)
SQL Reports in Statspack
SQL语句排行榜
SQL ordered by gets (读取buffer cache次
数最多的排行榜)
SQL ordered by reads (从磁盘上读的块到内
存里的数量的语句排行榜)
SQL ordered by executions (执行次数最多的
SQL的排行榜)
SQL ordered by parse calls (library cache中
的解析次数的排序)
如果性能不佳,将前几名的SQL语句进行调整,可能就得到
提高。OEM中也能展现出TOP SQL。
Execution Plan
An execution plan is a set of steps that the
optimizer performs when executing a SQL statement
and performing an operation.
Viewing Execution Plan
EXPLAN PLAN
SQL Trace
Automatic Workload Repository
V$SQL_PLAN
SQL*Plus AUTOTRACE
SELECT /*+ First_rows */ * FROM hr.employees;
SELECT /*+ ALL_ROWS */ * FROM hr.employees;
上面两个hint对应最佳response time与最佳thoughout。
Optimizer Plan Stability(稳定性)
同一个SQL语句在不同版本不同环境下,可能执行计划就不
同,从而导致性能不同。
Users can stabilize execution plans,to force
applications to use a desired SQL access path.
用户能强制稳定地使用某个执行计划。
A consistent execution path is thereby maintained
through database changes.
This is done by creating a stored outline consisting
of hints.(过时了,9i开始用了sql plan management代替
了)
The OPTIMIZER_FEATURES_ENABLE parameter enables the
optimizer to retain CBO features of previous
versions.
指定某个过去的版本号,就可以用过去版本的特性来运行这
个SQL语句。
alter system set OPTIMIZER_FEATURES_ENABLE=8.1.5
scope=spfile;
SQL Plan Management(9i开始取代了Stored outlines)
Diagnostic Tools诊断工具
*Statspack综合性报告
*EXPLAIN PLAN
*SQL trace and TKPROF(TKPROF是个解读trace文件的工具
)
*SQL*Plus autotrace feature
*Oracle SQL Analyze(OEM中的功能)
SQL Reports in Statspack
SQL语句排行榜
SQL ordered by gets (读取buffer cache次
数最多的排行榜)
SQL ordered by reads (从磁盘上读的块到内
存里的数量的语句排行榜)
SQL ordered by executions (执行次数最多的
SQL的排行榜)
SQL ordered by parse calls (library cache中
的解析次数的排序)
如果性能不佳,将前几名的SQL语句进行调整,可能就得到
提高。OEM中也能展现出TOP SQL。
Execution Plan
An execution plan is a set of steps that the
optimizer performs when executing a SQL statement
and performing an operation.
Viewing Execution Plan
EXPLAN PLAN
SQL Trace
Automatic Workload Repository
V$SQL_PLAN
SQL*Plus AUTOTRACE