Chinaunix首页 | 论坛 | 博客
  • 博客访问: 137135
  • 博文数量: 25
  • 博客积分: 460
  • 博客等级: 下士
  • 技术积分: 252
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-11 10:48
个人简介

努力学习,谦虚请教,不断提升!

文章分类

全部博文(25)

文章存档

2015年(3)

2014年(4)

2013年(3)

2012年(9)

2011年(6)

我的朋友

分类: DB2/Informix

2012-05-28 11:22:33

informix中理解统计更新
 
    
 
理解informix中的统计更新
内容提要:
1.介绍统计更新
当一个查询提交后,IDS优化器会算出如何执行这个查询的执行计划,优化器会分配成本
到每个执行计划,最后选择成本最低的那个执行计划。
统计更新主要有三个功能
(1)重新编译SPL
(2)删除distribution数据
(3)为优化器搜集必要信息
当计算一个执行计划成本时,优化器必须根据系统表来计算,主要是systables, sysindexes, syscolumns, and sysdistrib,
这些表中的某些关键列被使用。
systables (nrows, npused)
sysindexes (levels, leaves, nunique, clust)
syscolumns (colmin , colmax)
nrows - number of rows in the table
npused - number of data pages in the table
levels - number of levels of the btree index
leaves - number of leaves (lowest level) in the index
nunique - number of unique items in the first column of the index
clust - number of io operations required to access the index
colmin - the second lowest value in the table
colmax - the second hightest value in the table
当执行low级别优化时候,会重新更新这些表中相应字段的信息,为得到更多详细表的信息,必须创建data distribution,使用medium 或者 high 级别优化
才能产生data distribution信息,并且把这些信息存储到表sysdistrib中。很多情况里面,只使用systables,sysindexes,syscolumns会导致优化器不能选择一个
最佳的执行计划,所以必须创建data distribution信息。
2. 统计更新搜集信息
Data distribution信息产生是通过取样本列数据,然后排序,然后创建distributions bins,然后把这些记录插入到sysdistrib表中。
如果是high级别,样本数据是整个表。如果是medium级别,样本数据基于confidence和resolution参数。
基于confidence和resolution的样本数据的尺寸:
 
3. 统计更新的效率
提高效率主要有以下几部分。:
提高并行度
在创建data distribution过程中,数据排序是最耗时间的,所以必须打开PDQ,提高排序速度。
增加I/O吞吐
由于HIGH级别扫描整个表,对于大表可以使用light scan提高I/O吞吐。
Use of light scan to improve I/O throughput in big table,It will scan all table in high mode,so if it is a big table,we might use light scan to improve I/O scan.
减少取样数据
你可以通过控制样本数据尺寸扫描来提高统计更新的效率。
说明:
统计更新操作是informix数据库必须执行的操作,对于informix生产系统的性能起着决定性作用。
参考资料:
informix information center
 
 
 
阅读(2965) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~