• select/select 引起的read by other session


    select/select 引起的read by other session:
    P1 文件号
    
    P2 块号
    
    
    
    
    Select/Select 引发的buffer lock争用,发生在讲相同块载入到内存的过程。我们可以测试了解Select/Select 引发的buffer lock争用怎样发生的,测试方案如下:
    
    1) 创建拥有5W行的BFW_TEST表
    
    2) 多个进程同时对BFW_TEST表执行select
    
    3) 在此过程中,多个进程同时对同一个块获得buffer lock过程中,发生Buffer lock 竞争。
    
    ----创建测试表空间:
    
    
    create tablespace bfw_tbs datafile '/u03/test/bfw_tbs01.dbf' size 50M
    autoextend on 
    extent management local uniform size 1M
    segment space management auto;
    
    
    ---表的创建及生成5W行数据
    SQL> create table bfw_test(id char(1000)) tablespace bfw_tbs;
    
    表已创建。
    
    SQL> insert into bfw_test select '' from dba_objects where rownum<=50000;
    
    已创建50000行。
    
    SQL> commit;
    
    提交完成。
    
    ---对BFW_TEST 表执行Select的Procedure
    create or replace procedure bfw_do_select is
    begin
      for x in (select * from bfw_test) loop
        null;
      end loop;
    end;
    
    
    ----同时在20个会话上执行select
    var job_no number;
    begin
     for idx in 1 .. 20 loop
     dbms_job.submit(:job_no,'bfw_do_select;');
     end loop;
     commit;
     end;
    
    
                                                    NAME                            p1     p2     p3    
    1	24-6月 -14 08.53.05.105 上午	3	control file parallel write	  2	  3	  2	0	-1	0	0
    2	24-6月 -14 08.53.05.105 上午	11	null event	                0	  0	  0	0	-1	0	0
    3	24-6月 -14 08.53.05.105 上午	15	null event                    0	  0	  0	0	-1	0	0
    4	24-6月 -14 08.53.05.105 上午	18	read by other session	  6	43030	  1	0	76843	6	43030
    5	24-6月 -14 08.53.05.105 上午	19	null event	                0	  0	  0	0	-1	0	0
    6	24-6月 -14 08.53.05.105 上午	22	null event	0	0	0	0	-1	0	0
    7	24-6月 -14 08.53.05.105 上午	24	null event	0	0	0	0	-1	0	0
    8	24-6月 -14 08.53.05.105 上午	26	null event	0	0	0	0	-1	0	0
    9	24-6月 -14 08.53.05.105 上午	30	null event	0	0	0	0	-1	0	0
    10	24-6月 -14 08.53.05.105 上午	32	null event	0	0	0	0	-1	0	0
    11	24-6月 -14 08.53.05.105 上午	34	null event	0	0	0	0	-1	0	0
    12	24-6月 -14 08.53.05.105 上午	38	read by other session	6	39520	1	0	76843	6	39520
    13	24-6月 -14 08.53.05.105 上午	40	read by other session	6	39520	1	0	76843	6	39520
    14	24-6月 -14 08.53.05.105 上午	49	latch free	        1610726960	157	0	0	76843	6	38399
    15	24-6月 -14 08.53.05.105 上午	53	read by other session	6	40895	1	0	76843	6	40895
    16	24-6月 -14 08.53.05.105 上午	59	read by other session	6	29319	1	0	76843	6	29319
    17	24-6月 -14 08.53.05.105 上午	63	read by other session	6	29319	1	0	76843	6	29319
    18	24-6月 -14 08.53.05.105 上午	67	read by other session	6	30416	1	0	76843	6	30416
    19	24-6月 -14 08.53.05.105 上午	75	latch free	           1610726960	157	0	0	76843	6	20794
    20	24-6月 -14 08.53.05.105 上午	77	read by other session	6	26913	1	0	76843	6	26913
    21	24-6月 -14 08.53.05.105 上午	79	read by other session	6	20981	1	0	76843	6	20981
    
    
    read by other session:
    p1 file#
    
    p2 block#
    
    p3 class#
    SQL> select owner,segment_name,segment_type from dba_extents where file_id=6 and 40895 between block_id and block_id+blocks-1;
    
    OWNER			       SEGMENT_NAME									 SEGMENT_TYPE
    ------------------------------ --------------------------------------------------------------------------------- ------------------
    TEST			       BFW_TEST 									 TABLE
    
    
    
    

  • 相关阅读:
    spring的断言工具类Assert的基本使用
    开发工具推荐
    IDEA 接口调试插件 HTTP Client
    【笔记0-开篇】面试官系统精讲Java源码及大厂真题
    面试题:HashSet、TreeSet 和HashMap 的实现与原理
    Mybatis面试问题集锦
    分组拼接字符串,GROUP_CONCAT
    跨表更新,Mysql Update Join
    【设计模式】UML类图及Java的类之间的关系
    Sql性能优化梳理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13352250.html
Copyright © 2020-2023  润新知