Row design for effective space use
Record size is an important consideration in the design of a table. In Db2, a record is the storage representation of a row.
Db2 stores records within pages that are 4 KB, 8 KB, 16 KB, or 32 KB in size. Generally, you cannot create a table with a maximum record size that is greater than the page size. No other absolute limit exists, but you risk wasting storage space if you ignore record size in favor of implementing a good theoretical design.
If the record length is larger than the page size, increase the page size or consider using a large object (LOB) data type or an XML data type.
Record lengths and page size
The sum of the lengths of all the columns is the record length. The length of data that is physically stored in the table is the record length plus Db2 overhead for each row and each page. You can choose various page sizes for record lengths that best fit your needs.
If row sizes are very small, use the 4 KB page size. Use the default of 4-KB page sizes when access to your data is random and typically requires only a few rows from each page.
Some situations require larger page sizes. Db2 provides three larger page sizes of 8 KB, 16 KB, and 32 KB to allow for longer records. For example, when the size of individual rows is greater than 4-KB, you must use a larger page size. In general, you can improve performance by using pages for record lengths that best suit your needs.
Avoiding wasted space
If a table space contains large records that use up most of the page size and cannot fit additional records, that database design wastes space. In general, space is wasted in a table space that contains only records that are slightly longer than half a page because a page can hold only one record. If you can reduce the record length to just under half a page, you need only half as many pages. Similar considerations apply to records that are just over a third of a page, a quarter of a page, and so on. In these situations, you can use compression or increase the page size.