reorg ,runstats ,reorgchk
1.runstats 收集统计信息,2.reorgchk
针对系统表进行reorgchk
reorgchk update statistics on table system
针对用户表进行reorgchk
db2 reorgchk update statistics on table user
3. reorg 通过重构行来消除“碎片”数据并压缩信息,对表进行重组。 还有一个功能就
是可以将表中的数据按照某个索引关键字的顺序排列,从而可以减少某些查询i/o数
量。
当数据库里某个表中的记录变化量很大时,需要在表上做REORG操作来优化数据库性
能,值得注意的是,针对数据库对象的大量操作,如反复地删除表,存储过程,会引起
系统表中数据的频繁改变,在这种情况下,也要考虑对系统表进行REORG操作。
4.执行REORG可以考虑分为表上有索引和没有索引两种情况:
a.如表名为DB2INST1.STAFF,索引名为DB2INST1.ISTAFF
reorg table db2inst1.staff index db2inst1.istaff use tempspace1
b.建议REORG时使用USE参数指定数据重排时使用的临时表空间,否则,REORG工作将会
在表所在表空间中原地执行.如果表上有多个索引,INDEX参数值请使用最为重要的索
引名.
c.表上没有索引:
reorg table db2inst1.staff use tempspace1
reorg table sysibm.systables use tempspace1
页:
[1]