今天遇到了一个比较奇怪的问题,客户说把一个表分区后SELECT处理变慢了。本来SELECT处理变慢是很常见的问题,可是我看了10046Trace后还是感觉有些地方值得深究一下。

我们先来看看Tkprof之后的10046Trace。

◆分区前call count cpu elapsed disk query current rows

------- ------ -------- ---------- ---------- ---------- ---------- ----------

Parse 1 0.00 0.00 0 40 0 0

Execute 1 0.00 0.00 0 0 0 0

Fetch 1 2.41 2.58 15177 15177 0 1

------- ------ -------- ---------- ---------- ---------- ---------- ----------

total 3 2.42 2.59 15177 15217 0 1

Misses in library cache during parse: 1

Optimizer mode: ALL_ROWS

Parsing user id: 78

Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max) Row Source Operation

---------- ---------- ---------- ---------------------------------------------------

1 1 1 SORT AGGREGATE (cr=15177 pr=15177 pw=0 time=2583401 us)

0 0 0 FIRST ROW (cr=15177 pr=15177 pw=0 time=2583388 us cost=5601 size=14 card=1)

0 0 0 INDEX RANGE SCAN (MIN/MAX) XXXX_IX03 (cr=15177 pr=15177 pw=0 time=2583385 us cost=5601 size=14 card=1)(object id 254189)

Elapsed times include waiting on following events:

Event waited on Times Max. Wait Total Waited

---------------------------------------- Waited ---------- ------------

db file sequential read 15177 0.00 0.36

◆分区后call count cpu elapsed disk query current rows

------- ------ -------- ---------- ---------- ---------- ---------- ----------

Parse 1 0.00 0.00 0 0 0 0

Execute 1 0.00 0.00 0 0 0 0

Fetch 1 2.46 4.10 14828 14828 0 1

------- ------ -------- ---------- ---------- ---------- ---------- ----------

total 3 2.46 4.10 14828 14828 0 1

Misses in library cache during parse: 1

Optimizer mode: ALL_ROWS

Parsing user id: 78

Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max) Row Source Operation

---------- ---------- ---------- ---------------------------------------------------

1 1 1 SORT AGGREGATE (cr=14828 pr=14828 pw=0 time=4103521 us)

0 0 0 FIRST ROW (cr=14828 pr=14828 pw=0 time=4103511 us cost=4508 size=14 card=1)

0 0 0 INDEX RANGE SCAN (MIN/MAX) XXXX_IX15 (cr=14828 pr=14828 pw=0 time=4103509 us cost=4508 size=14 card=1)(object id 352194)

Elapsed times include waiting on following events:

Event waited on Times Max. Wait Total Waited

---------------------------------------- Waited ---------- ------------

db file sequential read 14828 0.00 1.85

从上面的数据来看,我们发现执行时间的差异主要来自索引的I/O待机“db file sequential read”。为了看看具体有啥区别,我们再来看看Tkprof之前的10046Trace文件。

◆分区前**-----------------------------------------------

WAIT #139891128650264: nam='db file sequential read' ela= 12 file#=15 block#=702838 blocks=1 obj#=254189 tim=45007446902

WAIT #139891128650264: nam='db file sequential read' ela= 11 file#=15 block#=702839 blocks=1 obj#=254189 tim=45007447264

WAIT #139891128650264: nam='db file sequential read' ela= 11 file#=15 block#=702840 blocks=1 obj#=254189 tim=45007447457

WAIT #139891128650264: nam='db file sequential read' ela= 75 file#=15 block#=702841 blocks=1 obj#=254189 tim=45007447706

WAIT #139891128650264: nam='db file sequential read' ela= 12 file#=15 block#=702842 blocks=1 obj#=254189 tim=45007447908

WAIT #139891128650264: nam='db file sequential read' ela= 10 file#=15 block#=702843 blocks=1 obj#=254189 tim=45007448123

WAIT #139891128650264: nam='db file sequential read' ela= 11 file#=15 block#=702844 blocks=1 obj#=254189 tim=45007448314

WAIT #139891128650264: nam='db file sequential read' ela= 15 file#=15 block#=702845 blocks=1 obj#=254189 tim=45007448503

WAIT #139891128650264: nam='db file sequential read' ela= 10 file#=15 block#=702846 blocks=1 obj#=254189 tim=45007448804

WAIT #139891128650264: nam='db file sequential read' ela= 11 file#=15 block#=702847 blocks=1 obj#=254189 tim=45007449000

-----------------------------------------------**

◆分区后-----------------------------------------------

WAIT #139891129837744: nam='db file sequential read' ela= 1535 file#=15 block#=5593761 blocks=1 obj#=352194 tim=45021020310

WAIT #139891129837744: nam='db file sequential read' ela= 1642 file#=15 block#=5593777 blocks=1 obj#=352194 tim=45021022129

WAIT #139891129837744: nam='db file sequential read' ela= 1037 file#=15 block#=5593538 blocks=1 obj#=352194 tim=45021023332

WAIT #139891129837744: nam='db file sequential read' ela= 947 file#=15 block#=5593554 blocks=1 obj#=352194 tim=45021024455

WAIT #139891129837744: nam='db file sequential read' ela= 1220 file#=15 block#=5593570 blocks=1 obj#=352194 tim=45021025868

WAIT #139891129837744: nam='db file sequential read' ela= 998 file#=15 block#=5593586 blocks=1 obj#=352194 tim=45021027237

WAIT #139891129837744: nam='db file sequential read' ela= 1109 file#=15 block#=5593602 blocks=1 obj#=352194 tim=45021028638

WAIT #139891129837744: nam='db file sequential read' ela= 1138 file#=15 block#=5593618 blocks=1 obj#=352194 tim=45021030019

WAIT #139891129837744: nam='db file sequential read' ela= 1251 file#=15 block#=5593634 blocks=1 obj#=352194 tim=45021031509

WAIT #139891129837744: nam='db file sequential read' ela= 1518 file#=15 block#=5593650 blocks=1 obj#=352194 tim=45021033196

…略…

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593539 blocks=1 obj#=352194 tim=45021040872

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593555 blocks=1 obj#=352194 tim=45021041034

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593571 blocks=1 obj#=352194 tim=45021041198

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593587 blocks=1 obj#=352194 tim=45021041350

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593603 blocks=1 obj#=352194 tim=45021041498

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593619 blocks=1 obj#=352194 tim=45021041661

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593635 blocks=1 obj#=352194 tim=45021041813

WAIT #139891129837744: nam='db file sequential read' ela= 26 file#=15 block#=5593651 blocks=1 obj#=352194 tim=45021041980

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593667 blocks=1 obj#=352194 tim=45021042177

…略…

WAIT #139891129837744: nam='db file sequential read' ela= 1007 file#=15 block#=5593882 blocks=1 obj#=352194 tim=45021070164

WAIT #139891129837744: nam='db file sequential read' ela= 1437 file#=15 block#=5593898 blocks=1 obj#=352194 tim=45021071788

WAIT #139891129837744: nam='db file sequential read' ela= 1158 file#=15 block#=5593914 blocks=1 obj#=352194 tim=45021073104

WAIT #139891129837744: nam='db file sequential read' ela= 1040 file#=15 block#=5593930 blocks=1 obj#=352194 tim=45021074307

WAIT #139891129837744: nam='db file sequential read' ela= 958 file#=15 block#=5593946 blocks=1 obj#=352194 tim=45021075424

WAIT #139891129837744: nam='db file sequential read' ela= 1145 file#=15 block#=5593962 blocks=1 obj#=352194 tim=45021076743

WAIT #139891129837744: nam='db file sequential read' ela= 997 file#=15 block#=5593978 blocks=1 obj#=352194 tim=45021077917

WAIT #139891129837744: nam='db file sequential read' ela= 1011 file#=15 block#=5593994 blocks=1 obj#=352194 tim=45021079129

WAIT #139891129837744: nam='db file sequential read' ela= 898 file#=15 block#=5594010 blocks=1 obj#=352194 tim=45021080218

WAIT #139891129837744: nam='db file sequential read' ela= 1450 file#=15 block#=5594026 blocks=1 obj#=352194 tim=45021081838

WAIT #139891129837744: nam='db file sequential read' ela= 1266 file#=15 block#=5594042 blocks=1 obj#=352194 tim=45021083270

…略…

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593867 blocks=1 obj#=352194 tim=45021088206

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593883 blocks=1 obj#=352194 tim=45021088362

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593899 blocks=1 obj#=352194 tim=45021088494

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593915 blocks=1 obj#=352194 tim=45021088628

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593931 blocks=1 obj#=352194 tim=45021088764

WAIT #139891129837744: nam='db file sequential read' ela= 9 file#=15 block#=5593947 blocks=1 obj#=352194 tim=45021088899

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593963 blocks=1 obj#=352194 tim=45021089031

WAIT #139891129837744: nam='db file sequential read' ela= 11 file#=15 block#=5593979 blocks=1 obj#=352194 tim=45021089205

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5593995 blocks=1 obj#=352194 tim=45021089339

WAIT #139891129837744: nam='db file sequential read' ela= 10 file#=15 block#=5594011 blocks=1 obj#=352194 tim=45021089485

…略…

WAIT #139891129837744: nam='db file sequential read' ela= 1412 file#=15 block#=5597225 blocks=1 obj#=352194 tim=45021203277

WAIT #139891129837744: nam='db file sequential read' ela= 1238 file#=15 block#=5597240 blocks=1 obj#=352194 tim=45021204680

WAIT #139891129837744: nam='db file sequential read' ela= 1027 file#=15 block#=5597255 blocks=1 obj#=352194 tim=45021205889

WAIT #139891129837744: nam='db file sequential read' ela= 1084 file#=15 block#=5597270 blocks=1 obj#=352194 tim=45021207169

WAIT #139891129837744: nam='db file sequential read' ela= 1263 file#=15 block#=5597285 blocks=1 obj#=352194 tim=45021208594

WAIT #139891129837744: nam='db file sequential read' ela= 1265 file#=15 block#=5597300 blocks=1 obj#=352194 tim=45021210019

…略…

-----------------------------------------------

通过上面的原始Trace,我们可以看到分区前的“db file sequential read”都是比较平均的10几个微秒,而分区后则出现间歇性的高达数千微秒的长待机。

关于具体的原因,现在还在调查,先说说我的几个猜测吧。1.访问对象数据块的位置和随机I/O的影响。表被分区后,索引的“CLUSTERING_FACTOR”受到分区Key的影响,聚簇情况发生变化。

2.单纯的I/O性能的变化影响。

等调查结果出来后我再更新。

2021/01/18 9:00AM

客户给了测试结果,原因就是单纯的I/O问题。

oracle db file sequential read,性能优化 ---- db file sequential read相关推荐

  1. oracle 9i hwm,Oracle 10g HWM原理及性能优化

    摘 要: HWM(High Water Mark)是表中已经使用过的存储空间与未使用过的存储空间之间的分界线,HWM对全表扫描的性能有非常大的影响.当全表扫描时,Oracle会读取HWM下所有的块,即 ...

  2. oracle hwm调整语法,Oracle 10g HWM原理及性能优化

    摘  要: HWM(High Water Mark)是表中已经使用过的存储空间与未使用过的存储空间之间的分界线,HWM对全表扫描的性能有非常大的影响.当全表扫描时,Oracle会读取HWM下所有的块, ...

  3. oracle no expand,NO_EXPAND Hint性能优化一例

    耗时较长的SQL select msn.serial_number, msi.description from mtl_system_items_tl msi , mtl_serial_numbers ...

  4. 12c oracle 修改内存_Oracle12c中性能优化功能增强新特性之重大突破——内存列存储新特性...

    Oracle12c中内存列存储 内存列存储(IM column store) 是Oracle12.1.0.2版本的主要特点.该特点允许列,表,分区和物化视图在内存中以列格式存储,而不是通常的行格式.数 ...

  5. Oracle发布更新使数据库性能优化达到75%

    甲骨文公司今天在甲骨文全球技术与应用大会(Oracle OpenWorld)上宣布,为优化Oracle软件和硬件而推出一款快速.现代和可靠的Linux内核--Oracle Unbreakable企业级 ...

  6. oracle 触发器性能优化,Oracle设计开发阶段的性能优化策略

    我们都知道提高Oracle数据库的相关系统的实际运行效率,它是整个计算机的实际应用信息系统的高效运行的前提与保证.其实影响Oracle设计开发阶段的相关性能的因素很多,既有软件方面的因素. 也包括数据 ...

  7. 12c oracle 修改内存_Oracle12c中性能优化amp;功能增强新特性之重大突破——内存列存储新特性...

    内存列存储(IM column store) 是Oracle12.1.0.2版本的主要特点.该特点允许列,表,分区和物化视图在内存中以列格式存储,而不是通常的行格式.数据存在内存中的好处显而易见,而列 ...

  8. oracle update from多表性能优化一例

    这几天测试java内存数据库,和oracle比较时发下一个update from语句很慢,如下: update business_newset fare1_balance_ratio = (selec ...

  9. oracle tabe unlock_Oracle 学习之性能优化(四)收集统计信息

    emp表有如下数据.SQL> select ename,deptno from emp; ENAME   DEPTNO ------------------------------ ------ ...

最新文章

  1. 腾讯精选练习 50 题(Leetcode)笔记 PDF下载!
  2. android+单利模式中传递context,Android的Context详解
  3. sql server 常见约束
  4. Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  5. C++编译出现binding ‘const string {aka const std::__cxx11::basic_string<char>}’ to reference of type ‘std
  6. linux php oauth安装,php – 无法在Linux上安装OAuth
  7. java中构造函数有什么用,java中的构造函数有什么用?用它有什么好处?在什么地方用?...
  8. 吴恩达神经网络和深度学习-学习笔记-19-机器学习策略(正交化+单一数字评估指标)
  9. 迅捷cad_迅捷元组
  10. golang笔记(1)-数据库查询结果映射至结构体
  11. 如何直接删除mysql中的重复数据_如何删除mysql数据库中重复的数据(部分重复)?...
  12. feign调用https接口_SpringCloudFeign远程调用
  13. 让你的手机不输kindle的3款epub阅读器
  14. java包装类string_Java学习之String类与包装类
  15. blog推荐 - 左岸读书
  16. 教师节快乐:带大家回顾这十位大师笔下的教师!
  17. html超链接几种写法
  18. android 应用软件注册与自动登录代码
  19. hypermesh 连接单元_基于HYPERMESH的抗扭拉杆悬置自由模态分析研究
  20. 树莓派+MediaPipe+PCA9685+自制摄像机云台实现人脸跟踪移动

热门文章

  1. C语言例题——输入年份和月份,显示该月有多少天
  2. 快速关断开关(用三极管来做开关)
  3. linux下git拉取代码到本地
  4. Imagination发布光线追踪等级系统
  5. CAD二次开发 导出构件生成新dwg
  6. UltraISO Premium Edition v9.5.2.2836注册码
  7. MS17-010 漏洞利用+修复方法
  8. 带孩子们做环球旅行的读后感_为什么要带孩子们去学乐高课程?
  9. 使用网络Ghost批量部署Windows Server 2008 R2
  10. 分享76个ASP整站程序源码,总有一款适合您