注册
sqlplus 有这么几个autotrace,disql呢?| 听说他们都羡慕disql有autotrace | 单SQL优化的一个关键信息/手段

sqlplus 有这么几个autotrace,disql呢?| 听说他们都羡慕disql有autotrace | 单SQL优化的一个关键信息/手段

hql 2021/10/30 2464 7 0
摘要 sqlplus 有这么几个autotrace,disql呢?最常用和主要的,可能是 autotrace trace里面,可以获取执行计划里面每一个操作符实际遍历行数(就是→右面的那个数值!!!—— MM再也不担心我无法判断预估行数准不准了)

sqlplus 有这么几个autotrace,disql呢?

sqlplus 有这么几个autotrace:查看详情

Autotrace Setting Result
SET AUTOTRACE OFF No AUTOTRACE report is generated. This is the default.
SET AUTOTRACE ON EXPLAIN The AUTOTRACE report shows only the optimizer execution path.
SET AUTOTRACE ON STATISTICS The AUTOTRACE report shows only the SQL statement execution statistics.
SET AUTOTRACE ON The AUTOTRACE report includes both the optimizer execution path and the SQL statement execution statistics.
SET AUTOTRACE TRACEONLY Like SET AUTOTRACE ON, but suppresses the printing of the user’s query output, if any.

disql呢?

其实就是 SET AUTOTRACE TRACE 比较正经(常用)
其他看看、了解下、知道还能这么执行不报错就行吧…

Autotrace Setting Result
SET AUTOTRACE OFF No AUTOTRACE report is generated. This is the default.
SET AUTOTRACE ON The AUTOTRACE report shows only the optimizer execution path.
SET AUTOTRACE TRACE The AUTOTRACE report includes both the optimizer execution path and the SQL statement execution statistics.
SET AUTOTRACE NL The AUTOTRACE report shows only the SQL statement execution nest loop.
SET AUTOTRACE INDEX The AUTOTRACE report shows only the SQL statement execution index…

disql的autotrace怎么用?

假定我们的windows服务器已经安装了达梦数据(并且服务已经启动了,用户名密码和端口号为默认)

C:\Users\noSelf\Downloads\1\bin>disql SYSDBA/SYSDBA 服务器[LOCALHOST:5236]:处于普通打开状态 登录使用时间 : 20.375(ms) disql V8 SQL> set autotrace on SQL> select * from dual a,dual b,dual c; 0 | CSCN2 | SYSDUAL2 as A | SYSINDEXSYSDUAL2 1 | CSCN2 | SYSDUAL2 as B | SYSINDEXSYSDUAL2 2 | CSCN2 | SYSDUAL2 as C | SYSINDEXSYSDUAL2 已用时间: 0.586(毫秒). 执行号:0. SQL> select * from dual a,dual b; 0 | CSCN2 | SYSDUAL2 as A | SYSINDEXSYSDUAL2 1 | CSCN2 | SYSDUAL2 as B | SYSINDEXSYSDUAL2 已用时间: 0.366(毫秒). 执行号:0. SQL> set autotrace trace; SQL> select * from dual a,dual b,dual c; 行号 DUMMY DUMMY DUMMY ---------- ----- ----- ----- 1 X X X 1 #NSET2: [1, 1->1, 3] 2 #PRJT2: [1, 1->1, 3]; exp_num(3), is_atom(FALSE) 3 #NEST LOOP INNER JOIN2: [1, 1->1, 3]; 4 #NEST LOOP INNER JOIN2: [1, 1->1, 2]; 5 #CSCN2: [1, 1->1, 1]; SYSINDEXSYSDUAL2(SYSDUAL2) 6 #CSCN2: [1, 1->1, 1]; SYSINDEXSYSDUAL2(SYSDUAL2) 7 #CSCN2: [1, 1->1, 1]; SYSINDEXSYSDUAL2(SYSDUAL2) 已用时间: 0.600(毫秒). 执行号:8902. SQL> set autotrace nl SQL> select * from dual a,dual b,dual c; 0 | NEST LOOP INNER JOIN2 | select * from dual a,dual b,dual c; 1 | NEST LOOP INNER JOIN2 | select * from dual a,dual b,dual c; 已用时间: 0.429(毫秒). 执行号:0. SQL> set autotrace index SQL> select * from dual a,dual b,dual c; 0 | CSCN2 | SYSDUAL2 as A | SYSINDEXSYSDUAL2 1 | CSCN2 | SYSDUAL2 as B | SYSINDEXSYSDUAL2 2 | CSCN2 | SYSDUAL2 as C | SYSINDEXSYSDUAL2 已用时间: 0.346(毫秒). 执行号:0. SQL> set autotrace off; SQL> select * from dual a,dual b; 行号 DUMMY DUMMY ---------- ----- ----- 1 X X 已用时间: 0.534(毫秒). 执行号:8906. SQL> exit C:\Users\noSelf\Downloads\1\bin>
评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服