1、數(shù)據(jù)庫對象大小評估
可以使用db2cc中的“Estimate Size”功能,預估一個對象消耗的空間范圍(最小值和最大值)
2、系統(tǒng)catalog空間大小
初始值大約3.5M,如果創(chuàng)建了DMS表空間,大概為20M。
3、用戶表數(shù)據(jù)空間大小:
1)一行數(shù)據(jù)不能跨越多個數(shù)據(jù)頁,建立在4K頁大小的表格最大可以有500個列;
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ù)時,通常根據(jù)free map選擇合適的空間存放新行,可以使用命令ALTER TABLE tabname APPEND ON,要求插入數(shù)據(jù)存儲為追加模式;
如果表格上有聚集索引,根據(jù)cluster key對應的數(shù)據(jù)頁插入新行
3、索引數(shù)據(jù)空間大小:
(average index key size + 9) * number of rows * 2
4、日志文件空間大小:
(logprimary + logsecond) * (logfilsiz + 2 ) * 4096
如果logsecond值為-1,表示激活的日志空間不受限制
容器和條帶關系
——————————-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—
縱坐標是container,橫坐標是Stripes
如果添加或刪除container,數(shù)據(jù)就可能發(fā)生rebalance;
rebalance期間,數(shù)據(jù)可以正常訪問和操作,但數(shù)據(jù)庫表現(xiàn)非常慢;
增加或擴充的container,如果被增加的空間在high-water mark上面,就不會發(fā)生rebalance,譬如:原表空間有幾個相同大小的容器,如果你對它們擴充相同的空間,就不會發(fā)生rebalance,或者給 表空間增加新容器時指定特別選項BEGIN NEW STRIPE SET,使數(shù)據(jù)不發(fā)生rebalance,新增的數(shù)據(jù)不會添加到原來的容器中,都將寫入新容器