关于"direct path write temp" wait event的实验

最近在优化各现场的系统,在一个现场的awr报告中,报出了"direct path write temp"等待,后来了解到该系统中要有大量对global temporary table的操作,虽然我们都清楚gtt的原理和机制,但为了确认该等待产生的真正原因,做了以下简单的测试,当然,是在一个测试环境:

--首先,创建一个session级的gtt:

CREATE GLOBAL TEMPORARY TABLE tmp_test (c1 number(10),c2 char(2000)) ON COMMIT PRESERVE ROWS;
--然后插入种子数据:

insert into tmp_test values(1,'aa');
insert into tmp_test values(2,'aa');
insert into tmp_test values(3,'aa');

--然后让种子发芽(执行多次):

insert into tmp_test select * from tmp_test;

--在种子发芽过程中,反应时间逐渐延长时,通过另外session查询等待,几个典型的等待为:
db file scattered read
db file sequential read
control file sequential read
control file parallel write
local write wait
buffer busy waits
db file parallel write
log file parallel write
--通过多次实验,得出结论:

对gtt的操作不会产生"direct path write temp"等待,因此,这个等待是系统存在大操作而disk操作的结果。

 

Oracle & Mysql & Postgresql & MSSQL 调优 & 优化
----------------------------------------------------------
《高性能SQL调优精要与案例解析》
blog1:http://www.cnblogs.com/lhdz_bj
blog2:http://blog.itpub.net/8484829
blog3:http://blog.csdn.net/tuning_optmization
原文地址:https://www.cnblogs.com/lhdz_bj/p/2176039.html