DB2 10.5 for Linux, UNIX, and Windows

Prefetch size adjustment when adding or dropping containers

The default size for all prefetches from disk is set automatically for any table spaces created using DB2® versions 8.2 and later. This means that the database manager calculates a suitable prefetch size based on several factors, including the extent size, the number of containers in your table space, and the properties of your storage devices.

The degree to which prefetches of data can take place in parallel is a function of, among other things, the number of containers in a table space. For example, if you have two or more containers, then prefetches from each container can happen in parallel, which can improve overall database performance. If you change the number of containers in a table space by adding or dropping containers, the amount of data that you can efficiently prefetch might change. For example if you add a container, but the number of extents prefetched remains unchanged, then you might not be taking advantage of the opportunity to fetch additional data from the new container in parallel with that from the other containers. As containers are added or dropped, adjusting the prefetch size accordingly can maintain or improve performance by making I/O happen more efficiently.

You can set the prefetch size for table spaces manually, but once you do so, you must ensure that you update it as you change the containers in your table space if you want to maintain optimal prefetch performance. You can eliminate the need to update the prefetch size manually by setting PREFETCHSIZE for the table space to AUTOMATIC when using the CREATE TABLESPACE or ALTER TABLESPACE statements. AUTOMATIC is the default value for PREFETCHSIZE, unless you have modified the default value for the dft_prefetch_sz configuration parameter.

If you want to manually specify the prefetch size, you can do so in three ways:

When manually adjusting the prefetch size, specify a size that corresponds to a disk stripe for optimal I/O parallelism. To calculate the prefetch size manually, use the formula:

number_of_containers × number_of_disks_per_container × extent_size

For example, assume the extent size for a database is 8 pages, and that there are 4 containers, each of which exists on a single physical disk. Setting the prefetch size to: 4 × 1 × 8 = 32 results in a prefetch size of 32 pages in total. These 32 pages will be read from each of the 4 containers in parallel.

If you have more than one physical disk per container, as you might if each container is made up of a RAID array, then to optimize I/O parallelism, ensure that the DB2_PARALLEL_IO registry variable is set correctly. (See Parallel I/O for table space containers that use multiple physical disks.) As you add or drop containers, if the prefetch size has been set manually, remember to update it to reflect an appropriate prefetch size. For example, assume each of 4 containers resides on a RAID 4+1 array, and the DB2_PARALLEL_IO registry variable has been set to allow for parallel prefetches from each physical disk. Assume also an extent size of 8 pages. To read in one extent per container, you would set the prefetch size to 4 × 4 × 8 = 128 pages.

Parallel I/O for table space containers that use multiple physical disks

Before the prefetch requests are submitted to the prefetch queues, they are broken down into a number of smaller, parallel prefetch requests, based on the number of containers in a table space. The DB2_PARALLEL_IO registry variable is used to manually override the parallelism of prefetch requests. (This is sometimes referred to as the parallelism of the table space). When DB2_PARALLEL_IO is set to NULL, which is the default, the parallelism of a table space is equal to the number of containers in the table space. If this registry variable is turned on, it defines the number of physical disks per container; the parallelism of a table space is equal to the number of containers multiplied by the value given in the DB2_PARALLEL_IO registry variable.

What follows are several other examples of how the DB2_PARALLEL_IO registry variable influences the parallelism of prefetches. Assume that table spaces have been defined with an AUTOMATIC prefetch size.