谁能给解释一下执行计划里面的几个参数,急!!!

[复制链接]
查看11 | 回复4 | 2006-4-17 13:46:34 | 显示全部楼层 |阅读模式
1、在sqlplus使用命令SET AUTOTRACE ON EXPLAIN后,执行查询然后出来的查询计划:
SELECT STATEMENT Optimizer=ALL_ROWS (Cost=985 Card=1 Bytes=26)
请问cost,card,bytes分别指的是什么?
2、在sqlplus使用命令SET AUTOTRACE ON后,执行查询然后出来的跟踪结果:
Statistics
----------------------------------------------------------
35recursive calls

0db block gets
1052consistent gets
7168physical reads

0redo size
395bytes sent via SQL*Net to client
512bytes received via SQL*Net from client

2SQL*Net roundtrips to/from client

0sorts (memory)

0sorts (disk)

1rows processed
其中recursive calls,db block gets,consistent gets分别指得是什么?
回复

使用道具 举报

千问 | 2006-4-17 13:46:34 | 显示全部楼层
consistent gets是指请求数据缓冲区中读的总次数。
Understanding Recursive Calls
Sometimes, in order to execute a SQL statement issued by a user, Oracle must issue additional statements. Such statements are called recursive calls or recursive SQL statements. For example, if you insert a row into a table that does not have enough space to hold that row, then Oracle makes recursive calls to allocate the space dynamically. Recursive calls are also generated when data dictionary information is not available in the data dictionary cache and must be retrieved from disk.
If recursive calls occur while the SQL trace facility is enabled, then TKPROF produces statistics for the recursive SQL statements and marks them clearly as recursive SQL statements in the output file. You can suppress the listing of Oracle internal recursive calls (for example, space management) in the output file by setting the SYS command-line parameter to NO. The statistics for a recursive SQL statement are included in the listing for that statement, not in the listing for the SQL statement that caused the recursive call. So, when you are calculating the total resources required to process a SQL statement, consider the statistics for that statement as well as those for recursive calls caused by that statement.
回复

使用道具 举报

千问 | 2006-4-17 13:46:34 | 显示全部楼层
· Recursive Calls. Number of recursive calls generated at both the user and system level.
Oracle Database maintains tables used for internal processing. When it needs to change these tables, Oracle Database generates an internal SQL statement, which in turn generates a recursive call.
In short, recursive calls are basically SQL performed on behalf of your SQL. So, if you had to parse the query, for example, you might have had to run some other queries to get data dictionary information. These would be recursive calls. Space management, security checks, calling PL/SQL from SQL—all incur recursive SQL calls.
· DB Block Gets. Number of times a CURRENT block was requested.

Current mode blocks are retrieved as they exist right now, not in a consistent read fashion.
Normally, blocks retrieved for a query are retrieved as they existed when the query began. Current mode blocks are retrieved as they exist right now, not from a previous point in time.
During a SELECT, you might see current mode retrievals due to reading the data dictionary to find the extent information for a table to do a full scan (because you need the "right now" information, not the consistent read). During a modification, you will access the blocks in current mode in order to write to them.
(DB Block Gets:请求的数据块在buffer能满足的个数)
· Consistent Gets. Number of times a consistent read was requested for a block.
This is how many blocks you processed in "consistent read" mode. This will include counts of blocks read from the rollback segment in order to roll back a block.
This is the mode you read blocks in with a SELECT, for example.
Also, when you do a searched UPDATE/DELETE, you read the blocks in consistent read mode and then get the block in current mode to actually do the modification.
(Consistent Gets:数据请求总数在回滚段Buffer中)
· Physical Reads. Total number of data blocks read from disk. This number equals the value of "physical reads direct" plus all reads into buffer cache.(Physical Reads:实例启动后,从磁盘读到Buffer Cache数据块数量)
· Sorts (disk). Number of sort operations that required at least one disk write. Sorts that require I/O to disk are quite resource intensive. Try increasing the size of the initialization parameter SORT_AREA_SIZE.
回复

使用道具 举报

千问 | 2006-4-17 13:46:34 | 显示全部楼层
楼上的两位可以把文档上传上来吗?
回复

使用道具 举报

千问 | 2006-4-17 13:46:34 | 显示全部楼层
recursive calls
表示数据库引擎为完成这个SQL的执行,自身需要执行SQL次数,
比如确认语法是否正确/是否有权限等情况执行的SQL都会算入recursive calls 的计数中
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行