Posted on 2009-07-31 13:41
Prayer 閱讀(614)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
DB2
1、數(shù)據(jù)庫對(duì)象大小評(píng)估
可以使用db2cc中的“Estimate Size”功能,預(yù)估一個(gè)對(duì)象消耗的空間范圍(最小值和最大值)
2、系統(tǒng)catalog空間大小
初始值大約3.5M,如果創(chuàng)建了DMS表空間,大概為20M。
3、用戶表數(shù)據(jù)空間大?。?br>1)一行數(shù)據(jù)不能跨越多個(gè)數(shù)據(jù)頁,建立在4K頁大小的表格最大可以有500個(gè)列;
When the page size is 4 KB, the row length can be up to 4005 bytes.
When the page size is 8 KB, the row length can be up to 8101 bytes.
When the page size is 16 KB, the row length can be up to 16 293 bytes.
When the page size is 32 KB, the row length can be up to 32 677 bytes.
2)數(shù)據(jù)頁不含有LONG VARCHAR, LONG VARGRAPHIC, BLOB, CLOB, or DBCLOB類型的數(shù)據(jù),只含有數(shù)據(jù)描述;
3)插入新數(shù)據(jù)規(guī)則
在常規(guī)表插入新數(shù)據(jù)時(shí),通常根據(jù)free map選擇合適的空間存放新行,可以使用命令A(yù)LTER TABLE tabname APPEND ON,要求插入數(shù)據(jù)存儲(chǔ)為追加模式;
如果表格上有聚集索引,根據(jù)cluster key對(duì)應(yīng)的數(shù)據(jù)頁插入新行
3、索引數(shù)據(jù)空間大小:
(average index key size + 9) * number of rows * 2
4、日志文件空間大?。?br>(logprimary + logsecond) * (logfilsiz + 2 ) * 4096
如果logsecond值為-1,表示激活的日志空間不受限制
容器和條帶關(guān)系
——————————-container——————
——————-0—————1————–2——-
———0——Extent0———Extent1——–Extent2—-
———1——Extent3———Extent4——–Extent5—-
Stripes–2——Extent6———Extent7——–Extent8—-
———3——Extent9———Extent10——-Extent11—
———4——Extent12——–Extent13——-Extent14—
———5——Extent15——–Extent16——-Extent17—
縱坐標(biāo)是container,橫坐標(biāo)是Stripes
如果添加或刪除container,數(shù)據(jù)就可能發(fā)生rebalance;
rebalance期間,數(shù)據(jù)可以正常訪問和操作,但數(shù)據(jù)庫表現(xiàn)非常慢;
增加或擴(kuò)充的container,如果被增加的空間在high-water mark上面,就不會(huì)發(fā)生rebalance,譬如:原表空間有幾個(gè)相同大小的容器,如果你對(duì)它們擴(kuò)充相同的空間,就不會(huì)發(fā)生rebalance,或者給 表空間增加新容器時(shí)指定特別選項(xiàng)BEGIN NEW STRIPE SET,使數(shù)據(jù)不發(fā)生rebalance,新增的數(shù)據(jù)不會(huì)添加到原來的容器中,都將寫入新容器