获得执行计划方法-一 ORACLE AUTOTRACE
admin
2023-05-14 13:42:05
0

ORACLE sql trace

    
AUTOTRACE 命令

1 SET AUTOTRACE OFF                   此为默认值,即关闭Autotrace
2 SET AUTOTRACE ON                    产生结果集和解释计划并列出统计
3 SET AUTOTRACE ON EXPLAIN            显示结果集和解释计划不显示统计
4 SETAUTOTRACE TRACEONLY              显示解释计划和统计,尽管执行该语句但您将看不到结果集
5 SET AUTOTRACE  TRACEONLY STATISTICS 只显示统计

SQL> set autotrace on
SQL> select * from dual
  2  ;

D
-
X


Execution Plan
----------------------------------------------------------
Plan hash value: 272002086

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------


Statistics
----------------------------------------------------------
          1  recursive calls
          0  db block gets
          3  consistent gets
          0  physical reads
          0  redo size
        407  bytes sent via SQL*Net to client
        385  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

各统计信息含义
db block gets    从buffer cache中读取的block的数量
consistent gets  从buffer cache中读取的undo数据的block的数量
physical reads   从磁盘读取的block的数量
redo size        DML生成的redo的大小
sorts (memory)   在内存执行的排序量
sorts (disk)     在磁盘上执行的排序量


db block gets 是取得current mode下的buffer cache
consistent gets 取的是consistent  mode 下buffer cache ,其中consistent  read 需要undo block 构造一致读块

官方文档如下

  • Current mode

    A current mode get, also called a db block get, is a retrieval of a block as it currently appears in the buffer cache.

    current mode 也叫 db block get ,是对buffer cache 中当前块的检索。

     For example, if an uncommitted transaction has updated two rows in a block, then a current mode get retrieves the block with these uncommitted rows. 

    例如,如果一个尚未提交的事物修改了一个块的两行,current模式个检索块时,包括两个尚未提交的行

    The database uses db block gets most frequently during modification statements, which must update only the current version of the block.

    数据库通常在使用修改语句时  使用db block get ,哪个必须修改当前块的版本。

  • Consistent mode

    A consistent read get is a retrieval of a read-consistent version of a block. This retrieval may use undo data.

    一致读读取的是块的一致性版本,这通常要使用undo 块。


     For example, if an uncommitted transaction has updated two rows in a block, and if a query in a separate session requests the block,

     例如 一个未提交事物修改了一个块的两行,另一个session查询这个块

     then the database uses undo data to create a read-consistent version of this block (called a consistent read clone) that does not include the uncommitted updates.

     数据库使用undo,创建一个一致读版本的块(被称为一致读的块克隆),不包含未提交的update。

     Typically, a query retrieves blocks in consistent mode.
    典型的,查询在一致读模式下进行检索




相关内容

热门资讯

美国随访记者吐槽在北京被罚款,... 执笔/胡一刀&月半刀&宝刀刀美国福克斯新闻台的主持人,想在北京街头,拍一个阴阳中国社会治理的故事。当...
武大开放校门之争,别急着过度拔... □徐林生5月13日,武汉大学正式取消社会公众进校预约制度。公众无需任何预约,仅凭本人身份证即可在珞珈...
李羚专题调研我市“圆梦工程”未... 5月15日下午,中国社会工作联合会副会长李羚率调研组一行来鄂州,开展“圆梦工程”未成年人心理健康教育...
力箭一号遥十三“一箭5星”发射... 新京报贝壳财经讯(记者张晓慧)5月15日12时33分,中科宇航力箭一号遥十三运载火箭·中国有戏号在东...
特朗普:美伊停火系“应其他国家... 新华社华盛顿5月15日电 美国总统特朗普15日在总统专机“空军一号”上接受采访时称,他本不赞成美国同...
镜观东莞・智见未来 | 克里特... AI眼镜产业风口正盛 东莞凭借完整产业链与强大制造能力 稳居全球AI眼镜出货量第一 在东莞凤岗,一家...
深耕智能制造 时代新材两工厂获... 上证报中国证券网讯(记者 夏子航)近日,湖南省工业和信息化厅正式公布2026年度先进级智能工厂认定名...
为190元榴莲“仅退款”千里讨... 5月15日,为190元榴莲“仅退款”驱车1600公里讨公道的电商商家“程大叔”通过社交平台账号公布,...
原创 经... 文 |地缘历史档案 编辑|地缘历史档案♬ 声明:拙见在此,抛砖引玉。诚邀您点个「关注」,方便日后...
“2026年顶流CEO”,暂未... 作者 | 第一财经 王珍用AI把自己的头像变为女生来回应“不是美女、为何天天刷屏”、被质疑后回应“有...