您的位置:首页 > 其它

【翻译自mos文章】在tkroof 中为什么物理读要比逻辑读要多

2015-12-25 23:04 633 查看



参考自:

Why Physical Read is greater than Logical Read in Tkprof (文档 ID 211700.1)

PURPOSE

In some circumstances, you can find that tkprof report shows more physical reads than logical reads, which isn't the current result as the physical reads are normally included in logical reads.

SCOPE & APPLICATION

This article will be useful for the DBA's and customers who are concerned by the tuning of Requests.

Why Physical reads are greater than Logical reads

Sometimes, you can find the following content in tkprof report:

Physical Reads = Disk (total)
Logical Reads = Query (total) + Current (total)

callcountcpuelapseddiskquerycurrentrows
-----------------------------------------------------------------------
Parse10.671.100000
Execute10.000.000000
Fetch2202167.48678.705794412834731741833014
-----------------------------------------------------------------------
total2204168.15679.815794412834731741833014
The 'disk' column is then greater than the 'query' + 'current' columns. This isn't usual.

To find the root cause of the problem, you must generate a 10046 event trace file level 8 and check for direct read waits in it.

In 10046 raw trace, you will find "direct path read" and "direct path write" waits like the example below:

WAIT #1: nam='direct path read' ela= 10076 p1=4 p2=29035 p3=1

with P1 = file#, P2 = start block#, P3 = num blocks

The "direct path read" waits account explains the difference between logical and physical reads.

In Oracle 9.2 and above, TKProf will print waits associated with each SQL statement in the output file.

Explanation:



The reason for more physical reads than logical reads is due to the number of direct reads block access. Direct path reads are generally used by Oracle when reading directly into PGA memory (as opposed to into the buffer cache).



They may happen on different actions:

Sort IO on disk.
Read by parallel Query Slaves when scanning is done.
Blocks read by anticipation (readahead).

Such reads are done without loading blocks into the Buffer Cache. They can be single or multiblock reads.

Utilizing Direct Path Reads in this manner prevents the Oracle Buffer cache from beeing overloaded.

Oracle uses this optimisation when it considers that its not necessary to share the blocks between different sessions.

References:

Note:32951.1 Tkprof Interpretation
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: