码迷,mamicode.com
首页 > 其他好文 > 详细

逻辑体系的实际应用

时间:2015-04-09 15:18:28      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

容量和速度:

  1. 实验1:针对不同的业务要有不同的容量规划:
    1. 分别创建两个类型的表空间A和B:A.初始1M,到极限后每次自动增长64k;B.直接给2G空间。
    2. 建两张表aa和bb,各自表空间分别是A和B。
    3. 同时往aabb插入1千万条数据。
    4. 由于A空间不够需要申请,每次扩展只有64k,所以比较耗时。
    5. 结果A:2分14秒 B:22秒
    6. select count( * ) from user_extents where segment_name=’aa’ :查看表aa有多少个extent。
  2. 实验2:PCTFREE和行迁移
    1. 首先建一个表,向里面插入200条数据(简单的字符)。
    2. 然后将表的字段容量改为2000
    3. 更新表的字段为2000的字符。
    4. 查看查询的逻辑读。
      create table rt1 (a varchar2(10),b varchar2(10),c varchar2(10));
      @procrt1.sql
      exec procrt1
      alter table rt1 modify a varchar2(2000);
      alter table rt1 modify b varchar2(2000);
      alter table rt1 modify c varchar2(2000);
      update rt1
      set a=lpad(1,2000,*),b=lpad(1,2000,*),c=lpad(1,2000,*);
      commit;
      set autotrace traceonly
      set linesize 1000
      select * from rt1;
      
      Statistics
      ----------------------------------------------------------
            0  recursive calls
            0  db block gets
          248  consistent gets
            0  physical reads
            0  redo size
          1212109  bytes sent via SQL*Net to client
          666  bytes received via SQL*Net from client
           15  SQL*Net roundtrips to/from client
            0  sorts (memory)
            0  sorts (disk)
          200  rows processed
      
      create table rt2 as select * from rt1;
      select * from rt2;
      
      Statistics
      ----------------------------------------------------------
            0  recursive calls
            0  db block gets
          204  consistent gets
            0  physical reads
            0  redo size
          1210909  bytes sent via SQL*Net to client
          666  bytes received via SQL*Net from client
           15  SQL*Net roundtrips to/from client
            0  sorts (memory)
            0  sorts (disk)
          200  rows processed
    5. procrt1:
      create or replace procedure procrt1
      as
      begin
          for i in 1..200
          loop
              insert into rt1 values( AA,BB,CC );
          end loop;
      commit;
      end;
      /
    6. 查询PCT_FREE值:
      select pct_free from user_tables where table_name=RT1;

逻辑体系的实际应用

标签:

原文地址:http://www.cnblogs.com/alexweng/p/4409501.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!