[转]并行查询并行度Degree与instances 设置

在DBA_TABLES字典表中有一个degree字段,这个字段代表并行查询在数据表上的并行度,在RAC环境中,这个参数还和实例有关。

    以下生活文档中对于 DEGREE 和 INSTANCES 参数的说明:

DEGREE VARCHAR2(10)      Number of threads per instance for scanning the table
INSTANCES VARCHAR2(10)    Number of instances across which the table is to be scanned

但是注意,当你使用类似如下查询时,你可能无法获得返回值:
SQL> select table_name from dba_tables where degree='1' or degree='DEFAULT';

no rows selected

我们看一下Degree以及instances的记录方式:
SQL> select degree,length(degree) from dba_tables
  2 group by degree;
DEGREE              LENGTH(DEGREE)
-------------------- --------------
  DEFAULT                      10
        1                      10

SQL>select instances,length(instances) from dba_tables
  2  group by instances;
INSTANCES            LENGTH(INSTANCES)
-------------------- -----------------
  DEFAULT                          10
        1                          10
        0                          10
Degree和Instances实际上记录了10个字符,左端用空格补齐。
在 dba_tables 的创建语句中,我们可以找到根本原因,以下是这两个字段的定义来源:
  lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10),
  lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10),

以上信息来自 Oracle10gR2数据库:
SQL> select table_name,owner from dba_tables where degree='  DEFAULT' or instances='  DEFAULT';

TABLE_NAME                    OWNER
------------------------------ ------------------------------
TEST_EXT2                      SYS

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

以下收录dba_tables视图的创建语句:
CREATE OR REPLACE VIEW dba_tables (owner,
                                  table_name,
                                  tablespace_name,
                                  cluster_name,
                                  iot_name,
                                  status,
                                  pct_free,
                                  pct_used,
                                  ini_trans,
                                  max_trans,
                                  initial_extent,
                                  next_extent,
                                  min_extents,
                                  max_extents,
                                  pct_increase,
                                  FREELISTS,
                                  freelist_groups,
                                  LOGGING,
                                  backed_up,
                                  num_rows,
                                  blocks,
                                  empty_blocks,
                                  avg_space,
                                  chain_cnt,
                                  avg_row_len,
                                  avg_space_freelist_blocks,
                                  num_freelist_blocks,
                                  DEGREE,
                                  INSTANCES,
                                  CACHE,
                                  table_lock,
                                  sample_size,
                                  last_analyzed,
                                  partitioned,
                                  iot_type,
                                  TEMPORARY,
                                  secondary,
                                  NESTED,
                                  BUFFER_POOL,
                                  row_movement,
                                  global_stats,
                                  user_stats,
                                  DURATION,
                                  skip_corrupt,
                                  MONITORING,
                                  cluster_owner,
                                  dependencies,
                                  compression,
                                  dropped
                                  )
AS
  SELECT u.NAME, o.NAME,
          DECODE (BITAND (t.property, 2151678048), 0, ts.NAME, NULL),
          DECODE (BITAND (t.property, 1024), 0, NULL, co.NAME),
          DECODE ((BITAND (t.property, 512) + BITAND (t.flags, 536870912)),
                  0, NULL,
                  co.NAME
                ),
          DECODE (BITAND (t.trigflag, 1073741824),
                  1073741824, 'UNUSABLE',
                  'VALID'
                ),
          DECODE (BITAND (t.property, 32 + 64),
                  0, MOD (t.pctfree$, 100),
                  64, 0,
                  NULL
                ),
          DECODE (BITAND (ts.flags, 32),
                  32, TO_NUMBER (NULL),
                  DECODE (BITAND (t.property, 32 + 64),
                          0, t.pctused$,
                          64, 0,
                          NULL
                        )
                ),
          DECODE (BITAND (t.property, 32), 0, t.INITRANS, NULL),
          DECODE (BITAND (t.property, 32), 0, t.MAXTRANS, NULL),
          s.iniexts * ts.BLOCKSIZE,
          DECODE (BITAND (ts.flags, 3),
                  1, TO_NUMBER (NULL),
                  s.extsize * ts.BLOCKSIZE
                ),
          s.minexts, s.maxexts,
          DECODE (BITAND (ts.flags, 3), 1, TO_NUMBER (NULL), s.extpct),
          DECODE (BITAND (ts.flags, 32),
                  32, TO_NUMBER (NULL),
                  DECODE (BITAND (o.flags, 2),
                          2, 1,
                          DECODE (s.lists, 0, 1, s.lists)
                        )
                ),
          DECODE (BITAND (ts.flags, 32),
                  32, TO_NUMBER (NULL),
                  DECODE (BITAND (o.flags, 2),
                          2, 1,
                          DECODE (s.GROUPS, 0, 1, s.GROUPS)
                        )
                ),
          DECODE (BITAND (t.property, 32 + 64),
                  0, DECODE (BITAND (t.flags, 32), 0, 'YES', 'NO'),
                  NULL
                ),
          DECODE (BITAND (t.flags, 1), 0, 'Y', 1, 'N', '?'), t.rowcnt,
          DECODE (BITAND (t.property, 64), 0, t.blkcnt, NULL),
          DECODE (BITAND (t.property, 64), 0, t.empcnt, NULL), t.avgspc,
          t.chncnt, t.avgrln, t.avgspc_flb,
          DECODE (BITAND (t.property, 64), 0, t.flbcnt, NULL),
          LPAD (DECODE (t.DEGREE, 32767, 'DEFAULT', NVL (t.DEGREE, 1)), 10),
          LPAD (DECODE (t.INSTANCES, 32767, 'DEFAULT', NVL (t.INSTANCES, 1)),
                10
              ),
          LPAD (DECODE (BITAND (t.flags, 8), 8, 'Y', 'N'), 5),
          DECODE (BITAND (t.flags, 6), 0, 'ENABLED', 'DISABLED'),
          t.samplesize, t.analyzetime,
          DECODE (BITAND (t.property, 32), 32, 'YES', 'NO'),
          DECODE (BITAND (t.property, 64),
                  64, 'IOT',
                  DECODE (BITAND (t.property, 512),
                          512, 'IOT_OVERFLOW',
                          DECODE (BITAND (t.flags, 536870912),
                                  536870912, 'IOT_MAPPING',
                                  NULL
                                )
                        )
                ),
          DECODE (BITAND (o.flags, 2), 0, 'N', 2, 'Y', 'N'),
          DECODE (BITAND (o.flags, 16), 0, 'N', 16, 'Y', 'N'),
          DECODE (BITAND (t.property, 8192),
                  8192, 'YES',
                  DECODE (BITAND (t.property, 1), 0, 'NO', 'YES')
                ),
          DECODE (BITAND (o.flags, 2),
                  2, 'DEFAULT',
                  DECODE (s.cachehint,
                          0, 'DEFAULT',
                          1, 'KEEP',
                          2, 'RECYCLE',
                          NULL
                        )
                ),
          DECODE (BITAND (t.flags, 131072), 131072, 'ENABLED', 'DISABLED'),
          DECODE (BITAND (t.flags, 512), 0, 'NO', 'YES'),
          DECODE (BITAND (t.flags, 256), 0, 'NO', 'YES'),
          DECODE (BITAND (o.flags, 2),
                  0, NULL,
                  DECODE (BITAND (t.property, 8388608),
                          8388608, 'SYS$SESSION',
                          'SYS$TRANSACTION'
                        )
                ),
          DECODE (BITAND (t.flags, 1024), 1024, 'ENABLED', 'DISABLED'),
          DECODE (BITAND (o.flags, 2),
                  2, 'NO',
                  DECODE (BITAND (t.property, 2147483648),
                          2147483648, 'NO',
                          DECODE (ksppcv.ksppstvl, 'TRUE', 'YES', 'NO')
                        )
                ),
          DECODE (BITAND (t.property, 1024), 0, NULL, cu.NAME),
          DECODE (BITAND (t.flags, 8388608), 8388608, 'ENABLED', 'DISABLED'),
          DECODE (BITAND (t.property, 32),
                  32, NULL,
                  DECODE (BITAND (s.spare1, 2048),
                          2048, 'ENABLED',
                          'DISABLED'
                        )
                ),
          DECODE (BITAND (o.flags, 128), 128, 'YES', 'NO')
    FROM SYS.user$ u,
          SYS.ts$ ts,
          SYS.seg$ s,
          SYS.obj$ co,
          SYS.tab$ t,
          SYS.obj$ o,
          SYS.obj$ cx,
          SYS.user$ cu,
          x$ksppcv ksppcv,
          x$ksppi ksppi
    WHERE o.owner# = u.user#
      AND o.obj# = t.obj#
      AND BITAND (t.property, 1) = 0
      AND BITAND (o.flags, 128) = 0
      AND t.bobj# = co.obj#(+)
      AND t.ts# = ts.ts#
      AND t.file# = s.file#(+)
      AND t.block# = s.block#(+)
      AND t.ts# = s.ts#(+)
      AND t.dataobj# = cx.obj#(+)
      AND cx.owner# = cu.user#(+)
      AND ksppi.indx = ksppcv.indx
      AND ksppi.ksppinm = '_dml_monitoring_enabled'

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12925485/viewspace-464453/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12925485/viewspace-464453/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.本版本的需要2.0框架支持<br>2.功能:<br> 支持数据缓存<br> 支持分页方式多样化<br> 支持SQL数据库<br> 支持GridView数据表格<br><br> 请注意若您需要用到图片分页模式请拷贝Images文件夹.如果需要定义自己的图片样式,请不要改变图片的名称即可.<br><br>3.不足 <br> 控件暂时只支持SQL数据库其他数据库的支持接口以完成还没来得及写,有时间我会升级<br> 控件暂时不支持存储过程<br> 现在发布的也只是个BATE版有BUG欢迎指正<br> 邮箱:wensifww@163.com<br> QQ:24754991<br> QQ群:24604453<br><br> <br>4版本升级<br> (1) SqlPage 1.0.1.0 版本:(修改时间:2006-11-23)<br> 1.修正了在不使用缓存的情况下控检不显示数据的BUG<br> 2.去除HasGridView属性该为控件自行判断数据表格类型<br> 3.增加在用缓存模式下改变SQL语句获得新数据功能<br> 4.在绑定表格后对表格操作后绑定更加简单只需添加SqlPage1.DataBind()方法即可<br> 去除程序员写繁琐的绑定CODE<br> 5.添加了ControlToPaginate内置属性用于获得当前控件所绑定的数据表格控件<br> <br> (2)SqlPage 1.0.1.2 版本:(修改时间:2007-1-27)<br> 1.修正了表格控检在多层中SqlPage找不到绑定控件的BUG。 <br> 2.应很多朋友呼吁删除排序字段开发排序SQL语句,由程序员自己写<br><br> (3)SqlPage 1.1.4.8 版本:(修改时间:2007-7-31)<br> 1.优化数据读取(支持百万级数据读取)<br> 2.分页控件资源集成化,不需要用户Copy控件资源文件<br> 3.分页控件排序优化:默认情况下为表主键排序<br> 4.修正分页控件在删除当前索引也中所有行不能自动到上一页的错误<br> 5.添加分页的排序方式<br> 6.自定义排序的字段<br> 7.修正在除GridView外表格控件绑定空数据库时出错问题<br> 8.修正用户SQL语句后面带分号出错<br> 9.修正降序排序单页显示成升序的错误<br> (4)SqlPage 1.2.2.3 版本:(修改时间:2007-8-9)<br> 1.修正MSSQL用户SQL语句中同时带有TOP 和ORDER BY 语句程序不能识别问题<br> 2.添加了以分页段的分页样式丰富了分页样式<br> 3.做了一个控制分页控件样式表(CSS)的DOME(有朋友不知道怎么去控制这里简单的 说明使用方法,很简单)<br> 4.修正MSSQL用户SQL语句中ORDER BY再次绑定的问题 <br> 5.修正控件分页模式在图片分页模式下控件编辑状态出错问题<br> 6.新添了控件自动添加前缀功能(Wensi)<br> 7.新增分页跳类型,两种:下拉列表框和文本框,系统默认为下拉列表框,(在实际开发中我们发现下拉列表框在分页数达到1000级以上的时候明显变慢,所以建议大家在分页数很大时使用文本框类型这样可以明显提高效率)<br> 8.新增控件样式CSS文件是否用系统自带的样式文件还是用户自定义样式文件属性 HasSystemPageStyle<br> (5)SqlPage 1.2.5.3 版本:(修改时间:2007-10-24)<br> 1.修改了在2次绑定无数据时现实前一次绑定数据的BUG<br> 2.修改了在页面索引为-1时系统不能正常恢复显示数据BUG<br>如果您在使用中发现BUG或有很好的建议请联系我,让大家一起参与进来维护好这个控件.<br>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值