Chinaunix首页 | 论坛 | 博客
  • 博客访问: 118290
  • 博文数量: 9
  • 博客积分: 1485
  • 博客等级: 上尉
  • 技术积分: 235
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-27 13:17
文章分类

全部博文(9)

文章存档

2011年(1)

2010年(3)

2009年(1)

2008年(4)

分类:

2008-06-18 17:21:19

 
 

检查各个dbspaces的空间使用状况:
select name dbspace,sum(chksize) allocated,sum(nfree) free,round(((sum(chksize)-sum(nfree))/sum(chksize))*100)||"%" pcused
form sysdbspaces d,syschunks c
where d.dbsnum=c.dbsnum group by name order by 4 desc
显示各个dbspaces的I/O状况:
select d.name,fname path_name,sum(pagesread) diskreads,sum(pageswritten) diskwrites
from syschkio c,syschunks k,sysdbspaces d
where d.dbsnum=k.dbsnum and k.chknum=c.chunknum
group by 1,2 order by 3 desc
检查哪个表具有最多的磁盘I/0:
select dbsname, tabname, (isreads + pagreads) diskreads, (iswrites + pagwrites) diskwrites
from sysptprof
order by 3 desc,4 desc
检查表的extent的分布状况:
select t.tabname, count(*) num_ext
from sysextents e, npmdb:systables t
where e.tabname=t.tabname
and dbsname = "npmdb"
and t.tabname not like "sys%"
group by 1
having count(*) > 1
order by 2 desc
检查表中索引的层数(越少越好):
select idxname, levels from sysindexes order by 2 desc
检查命中率不高的索引(nrows和unique越接近越好):
select tabname, idxname, nrows, nunique
from systables t, sysindexes I
where t.tabid =i.tabid and t.tabid > 99
and nrows > 0 and nunique > 0

看数据库里面那些表的碎片比较多(碎片小比较好)
select dbsname , tabname ,count(*), sum(size)
from sysextents
group by 1,2
order by 3 desc;

表和索引的读写情况,(考查那个数据库实体读写比较多)
select dbsname, tabname, (isreads + pagreads) diskreads, (iswrites + pagwrites)
diskwrites
from sysptprof
order by 3 desc, 4 desc

那些表的锁竞争比较厉害(越小越好)
select a.tabname,nrows,lockwts,deadlks
from sysmaster:sysptprof a,systables b
where a.tabname=b.tabname and lockwts>0
and a.dbsname = 库名
and b.tabid >= 100
order by tabname;

表的顺序扫描数(OLTP系统的话,大表的顺序扫描数越小越好)
select a.tabname,nrows,seqscans
from sysmaster:sysptprof a,systables b
where a.tabname=b.tabname and seqscans>0
and a.dbsname = '库名'
and b.tabid>=100
order by tabname;

阅读(1147) | 评论(0) | 转发(0) |
0

上一篇:informix数据库与表信息

下一篇:什么是dhcp

给主人留下些什么吧!~~