DB2 Architecture Overview
DB2 Architecture Overview
DB2 Architecture
Architectural components
1. Tablespace
2. Container
3. Buffer Pool
4. Page Size
TABLESPACE
A tablespace needs to know where data is stored physically.
DB2 distinguishes between two possible data locations: System managed
(Files handled by the operating system) and
Database managed (Files handled by the database or Devices).
In the latter case the database will preallocate space for the files or
devices, giving a slightly faster operation.
On the other hand, database managed files cannot grow automatically.
BUFFER POOL
A buffer pool is associated with a single database and can be used by more
than one table space.
When considering a buffer pool for one or more table spaces, you must
ensure that the table space page size
and the buffer pool page size are the same for all table spaces. A table space
can only use one buffer pool.
When the database is created, a default buffer pool named IBMDEFAULTBP
is created which is shared by all table spaces.
More buffer pools can be added by using the CREATE BUFFERPOOL
statement.
The buffer pool size defaults to the size specified by the BUFFPAGE
database configuration parameter but can be overridden by
specifying the SIZE keyword in the CREATE BUFFERPOOL command.
Adequate buffer pool size is essential to good database
performance since it will reduce disk I/O, the most time consuming operation.
Large buffer pools will also have an effect on query optimization, since more
of the work can be done in memory.
CONTAINERS
Every table space has one or more containers.Each container can only
belong to a single table space but a table space can have many containers.
Containers can be added to or dropped from a DMS table space, and their
sizes can be modified. Containers can only be added to SMS table spaces on
partitioned databases in a partition, which does not yet have a container
allocated for the table space. When new containers are added, an automatic
rebalancing will start to distribute the data across all containers.
PAGE SIZE
Defines the size of pages used for the table space. Sizes supported are
4K, 8K, 16K and 32K. The page size limits the row length and column count
of tables that can be placed in the table space according to the following
table:
Table spaces are limited to 16384 pages, so choosing a larger page size will
increase the capacity of the table space.
Extent size
Specifies the number of pages that will be written to a container before
skipping to the next container. The database manager cycles repeatedly
through the containers as data is stored. This parameter has effect only when
there are multiple containers for the table space.
Prefetch size
Specifies the number of pages that will be read from the table space when
data prefetching is being performed. Prefetching reads in data needed by a
query prior to its being referenced by the query so that the query need not
wait for I/O to be performed. Prefetching is selected by the database
manager when it determines that sequential I/O is appropriate and that
prefetching may help to improve performance.