db2收集统计信息(runstats)

[db2inst1@xifenfei ~]$ db2 connect to xff

Database Connection Information

Database server = DB2/LINUX 9.5.9

SQL authorization ID = DB2INST1

Local database alias = XFF

[db2inst1@xifenfei ~]$ db2 list tables

Table/View Schema Type Creation time

------------------------------- --------------- ----- --------------------------

T_01XFF DB2INST1 T 2012-04-11-18.23.05.723478

T_02XFF DB2INST1 T 2012-04-11-18.30.26.639326

T_03XFF DB2INST1 T 2012-04-11-21.33.12.479480

3 record(s) selected.

[db2inst1@xifenfei ~]$ db2 "select STATS_TIME from syscat.tables where tabname in('T_01XFF','T_02XFF','T_03XFF')"

STATS_TIME

--------------------------

2012-04-12-04.35.07.539790

2012-04-11-19.55.12.023748

2012-04-11-22.20.07.016905

3 record(s) selected.

--收集表和索引统计信息,包括数据分布

[db2inst1@xifenfei ~]$ db2 "runstats on table db2inst1.t_01xff on all columns

with distribution and detailed indexes all"

DB20000I The RUNSTATS command completed successfully.

[db2inst1@xifenfei ~]$ db2 "select STATS_TIME from syscat.tables where tabname in('T_01XFF')"

STATS_TIME

--------------------------

2012-04-28-23.43.23.904759

1 record(s) selected.

--收集索引统计信息,如果表没有被收集,也会同时对表收集统计信息,对不会收集数据分布信息

[db2inst1@xifenfei ~]$ db2 "runstats on table db2inst1.t_02xff for indexes all"

DB20000I The RUNSTATS command completed successfully.

[db2inst1@xifenfei ~]$ db2 "select STATS_TIME from syscat.tables where tabname in('T_01XFF','T_02XFF')"

STATS_TIME

--------------------------

2012-04-28-23.43.23.904759

2012-04-28-23.44.39.762858

2 record(s) selected.

db2 reorg操作

--删除部分表数据

[db2inst1@xifenfei ~]$ db2 "delete from t_01xff"

DB20000I The SQL command completed successfully.

[db2inst1@xifenfei ~]$ db2 "delete from t_03xff"

DB20000I The SQL command completed successfully.

--reorgchk检查是否需要进行reorg

[db2inst1@xifenfei ~]$ db2 reorgchk on schema db2inst1

Doing RUNSTATS ....

Table statistics:

F1: 100 * OVERFLOW / CARD < 5

F2: 100 * (Effective Space Utilization of Data Pages) > 70

F3: 100 * (Required Pages / Total Pages) > 80

SCHEMA.NAME CARD OV NP FP ACTBLK TSIZE F1 F2 F3 REORG

----------------------------------------------------------------------------------------

Table: DB2INST1.T_01XFF

0 0 0 42 - 0 0 0 0 -**

Table: DB2INST1.T_02XFF

371 0 42 42 - 152110 0 100 100 ---

Table: DB2INST1.T_03XFF

0 0 0 83 - 0 0 0 0 -**

----------------------------------------------------------------------------------------

Index statistics:

F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80

F5: 100 * (Space used on leaf pages / Space available on non-empty leaf pages) > MIN(50, (100 - PCTFREE))

F6: (100 - PCTFREE) * (Amount of space available in an index with one less level / Amount of space required for all keys) < 100

F7: 100 * (Number of pseudo-deleted RIDs / Total number of RIDs) < 20

F8: 100 * (Number of pseudo-empty leaf pages / Total number of leaf pages) < 20

SCHEMA.NAME INDCARD LEAF ELEAF LVLS NDEL KEYS LEAF_RECSIZE NLEAF_RECSIZE LEAF_PAGE_OVERHEAD NLEAF_PAGE_OVERHEAD F4 F5 F6 F7 F8 REORG

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Table: DB2INST1.T_01XFF

Index: DB2INST1.I_T_01XFF

0 3 3 2 0 0 2 2 822 822 100 0 - 0 100 ----*

--------------------------------------------------------------------------------------------------------------------------------------------------------------

CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is necessary

for indexes that are not in the same sequence as the base table. When multiple

indexes are defined on a table, one or more indexes may be flagged as needing

REORG. Specify the most important index for REORG sequencing.

Tables defined using the ORGANIZE BY clause and the corresponding dimension

indexes have a '*' suffix to their names. The cardinality of a dimension index

is equal to the Active blocks statistic of the table.

--离线reorg index

[db2inst1@xifenfei ~]$ db2 reorg table db2inst1.t_01xff index DB2INST1.I_T_01XFF allow read access

DB20000I The REORG command completed successfully.

--在线reorg table

[db2inst1@xifenfei ~]$ db2 reorg table db2inst1.t_01xff inplace allow write access

DB20000I The REORG command completed successfully.

DB21024I This command is asynchronous and may not be effective immediately.

[db2inst1@xifenfei ~]$ db2 reorg table db2inst1.t_03xff inplace allow write access

DB20000I The REORG command completed successfully.

DB21024I This command is asynchronous and may not be effective immediately.

--证明异步操作完成

[db2inst1@xifenfei ~]$ ps -ef|grep db2reo

db2inst1 1496 1311 0 00:24 pts/1 00:00:00 grep db2reo

--检查reorg操作结果

[db2inst1@xifenfei ~]$ db2 reorgchk on schema db2inst1

Doing RUNSTATS ....

Table statistics:

F1: 100 * OVERFLOW / CARD < 5

F2: 100 * (Effective Space Utilization of Data Pages) > 70

F3: 100 * (Required Pages / Total Pages) > 80

SCHEMA.NAME CARD OV NP FP ACTBLK TSIZE F1 F2 F3 REORG

----------------------------------------------------------------------------------------

Table: DB2INST1.T_01XFF

0 0 0 1 - 0 0 - 0 ---

Table: DB2INST1.T_02XFF

371 0 42 42 - 152110 0 100 100 ---

Table: DB2INST1.T_03XFF

0 0 0 1 - 0 0 - 0 ---

----------------------------------------------------------------------------------------

Index statistics:

F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80

F5: 100 * (Space used on leaf pages / Space available on non-empty leaf pages) > MIN(50, (100 - PCTFREE))

F6: (100 - PCTFREE) * (Amount of space available in an index with one less level / Amount of space required for all keys) < 100

F7: 100 * (Number of pseudo-deleted RIDs / Total number of RIDs) < 20

F8: 100 * (Number of pseudo-empty leaf pages / Total number of leaf pages) < 20

SCHEMA.NAME INDCARD LEAF ELEAF LVLS NDEL KEYS LEAF_RECSIZE NLEAF_RECSIZE LEAF_PAGE_OVERHEAD NLEAF_PAGE_OVERHEAD F4 F5 F6 F7 F8 REORG

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Table: DB2INST1.T_01XFF

Index: DB2INST1.I_T_01XFF

0 1 0 1 0 0 2 2 822 822 100 - - 0 0 -----

--------------------------------------------------------------------------------------------------------------------------------------------------------------

CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is necessary

for indexes that are not in the same sequence as the base table. When multiple

indexes are defined on a table, one or more indexes may be flagged as needing

REORG. Specify the most important index for REORG sequencing.

Tables defined using the ORGANIZE BY clause and the corresponding dimension

indexes have a '*' suffix to their names. The cardinality of a dimension index

is equal to the Active blocks statistic of the table.

mysql的reorg_DB2 runstats和reorg操作相关推荐

  1. MYSQL连接一段时间不操作后出现异常的解决方案

    MYSQL连接一段时间不操作后出现异常的解决方案 参考文章: (1)MYSQL连接一段时间不操作后出现异常的解决方案 (2)https://www.cnblogs.com/bokejiayuan/p/ ...

  2. MySQL数据库https接口_第三章 mysql 数据库接口程序以及SQL语句操作

    mysql  数据库接口程序以及SQL语句操作 用于管理数据库: 命令接口自带命令 DDL:数据定义语言(create drop ) DCL: 数据控制语言(grant revoke) DML: 数据 ...

  3. flask 操作mysql的两种方式-sqlalchemy操作

    flask 操作mysql的两种方式-sqlalchemy操作二.ORM sqlalchemy操作#coding=utf-8 # model.pyfrom app import dbclass Use ...

  4. mysql驱动_python3 接口测试数据驱动之操作mysql数据库

    python3 接口测试数据驱动之操作mysql数据库 1.1 操作mysql数据库 1.1.1 python3操作mysql介绍 操作数据库是程序员常用的技能之一,mysql数据库是中小型项目的首选 ...

  5. [Python从零到壹] 八.数据库之MySQL和Sqlite基础知识及操作万字详解

    欢迎大家来到"Python从零到壹",在这里我将分享约200篇Python系列文章,带大家一起去学习和玩耍,看看Python这个有趣的世界.所有文章都将结合案例.代码和作者的经验讲 ...

  6. mysql第四篇:数据操作之多表查询

    mysql第四篇:数据操作之多表查询 一.多表联合查询 #创建部门 CREATE TABLE IF NOT EXISTS dept (did int not null auto_increment P ...

  7. druid不能close mysql连接_druid长时间无操作无法保持连接!!

    纯原生JAVA项目中,Druid作为MySQL连接池时(MySQL默认为8小时没操作就断开),测试场景为10小时不进行任何查询,就算配置了testWhileIdle=true,也不能保持连接,配置如下 ...

  8. 已管理员身份从cmd框进入mysql,及常用的简单操作!

    在命令框中操作mysql已管理员的身份进入操作权限较高,已普通用户进入cmd框也可对mysql进行操作,不过一般建议用管理员身份进入. 1.启动MYSQL Notifier 2.已管理员身份进入cmd ...

  9. Mysql 电商常用的时间操作(当天,昨天,7天,30天,半年,全年,季度等等)...

    2019独角兽企业重金招聘Python工程师标准>>> Mysql 电商常用的时间操作(当天,昨天,7天,30天,半年,全年,季度等等) 1 . 查看当天日期 select curr ...

最新文章

  1. NOIP2015神奇的幻方
  2. 网络流24题 飞行员配对方案问题
  3. linux x window system下载,为Ubuntu 添加 KDE X WINDOW SYSTEM
  4. 二十、异步调用的问题
  5. React Native开发环境搭建记录
  6. DBA查询命令积累——不断更新
  7. matlab中将数据保存为txt文件_matlab中将数据输出保存为txt格式文件的方法 (1)
  8. android 重叠view 重叠布局,按比例布局
  9. 常用浏览器修改User-Agent的方法
  10. 活动目录数据库重定向或迁移
  11. perl 调用 shell 文件 防止出问题,最好写绝对路径
  12. IOS CopyPNGFile 异常问题解决
  13. android 联系人中,在超大字体下,加入至联系人界面(ConfirmAddDetailActivity)上有字体显示不全的问题...
  14. C++ 二叉树深度优先遍历和广度优先遍历
  15. HDU1317 —— 最长路+判断正环
  16. phpmywind 数据库 上传服务器后乱码
  17. 截图工具当前未在计算机上运行 请重启_一个顶十个的工具箱软件,这才是真正的装机必备。...
  18. ​两年前不知如何编写代码的我,现在是一名人工智能工程师
  19. 2022年数维杯数学建模C题 电动汽车充电站的部署优化策略求解全过程文档及程序
  20. 室内装饰培训 地面装饰要注意什么

热门文章

  1. Java 20 超神版正式发布,展示了 Java 技术的最新进展
  2. 东方国信携手Cloudera 共创Hadoop生态圈辉煌
  3. Python之Email邮箱账号抓取
  4. PC - 史上最简单的远程访问群晖 NAS 方法
  5. Goose Goose Duck
  6. Hystrix实现熔断降级
  7. undefined、null与NaN的区别
  8. 允许或禁止未知来源apk的安装
  9. cmd导入sql数据
  10. 盗取QQ密码的顽固的IEXPLORE.EXE病毒