IBM DB2数据库性能调整命令: 查看执行计划:
db2expln:
db2expln -d dbname -c pkgOwner -p pkgNmae -o expln.out
dynexpln:
dynexpln -d eos -q "select * from eosmenu" -g -t
dynexpln -d eos -f query.sql -o out.txt
更新统计信息:
runstats:
db2 runstats on table songxn.eosmenu and indexs songxn.ix1,songxn.ix2 allow read access
db2 runstats on table songxn.eosmenu with distribution and detailed index all
建立索引:
create unique index ind1 on vicky.staff ( dept, lastname )
create unique index ind2 on vicky.emplyee ( empno ) include ( lastname, salary)
include中的字段不列入排序范围
丛集索引:
记录与索引的顺序一致
cretae index ind3 on vicky.staff ( dept ) CLUSTER
SCAN MODE:
Index Scan,Full Index Scan(Index only Access),Relation Scan
查询索引:
select indname from syscat.indexes where tabname='customer'
在数据页中预留空间:
alter table vicky.staff PCTFREE 30(预留30%)
load from staff.ixf of ixf modified by pagefreespace=30 replace into vicky.staff
缓冲池与IO
默认为IBMDEFAULTBP