Tablespaces are used to store tables. Abstract physical storage is composed of one or more containers. That is to say, tablespaces can be distributed on one or more physical devices. Table space of 4 k, 8 k, 16 k, and 32 k page size. To improve performance, you can store the index of one table to another table space and store large objects to the third table space. The data of any table is stored cyclically in all containers of the table space; default tablespaces include: SYSCATSPACE (4 K, storage system directory and table), TEMPSPACE1 (4 K, temporary tablespace), and USERSPACE1 (4 K, user tablespace ).
There are four types of tablespaces: REGULAR (such as USERSPACE1), system temporary (such as TEMPSPACE1), LARGE (used to store LOB data), and user temporary (used to store user temporary tables ).
Tablespaces are managed into system Management tablespaces (SMS: system manage space) and database management tablespaces (DMS ). For SMS tablespace, each container is a directory in the file space of the operating system, which is controlled by the File Manager of the operating system. For DMS tablespaces, each container, a pre-allocated file of a fixed size, or a physical device (such as a disk), the database manager controls the storage space.
SMS tablespace. Its container is the directory of the file system and is not pre-allocated. The size is limited to the size of the file directory. The number of containers is determined at the time of creation and cannot be modified; if the SMS tablespace is used, user data cannot be stored separately, that is, user data cannot be stored separately in data, index, and big data table space. DMS tablespace, whose container is file or raw devices, can be added, modified, or changed. If DMS tablespace is used, user data can be stored separately, that is, user data can be stored in the INDEX, TABLE, and LOB tablespaces respectively.
A buffer pool refers to the primary storage allocated to read or modify cache tables and index data pages from disks. The purpose of the buffer pool is to improve system performance. Data access from the memory is much faster than data access from the disk. Therefore, the database manager needs to read and write less disk (I/O) times, and the performance is better. Multiple buffer pools can be created. Although only one buffer pool is required in most cases, we recommend that you create a buffer pool for each page-sized tablespace.
The buffer pool is used to cache tables or indexes. A database must have at least one buffer pool. The page size of the buffer pool can be 4 k, 8 k, 16 k, or 32 k; the page size of the tablespace must be consistent with that of the buffer pool. The buffer pool is used to reduce direct I/O access and increase the I/O access speed. The default buffer pool is ibmdefabp BP (4 K ).
If you want the Database Manager to automatically adjust the buffer pool in DB2 V9, first set the database parameter SELF_TUNING_MEM to ON. Second, you must specify the AUTOMATIC attribute when creating the buffer pool, for example, creating the buffer pool BP1, you can use the following command to create an instance:
Create bufferpool "BP1" immediate size 250 automatic pagesize 4 K;
If you want the Database Manager to automatically adjust the created buffer pool, you can run the alter bufferpool command to modify it, for example, modify the IBMDEFAULTBP Buffer Pool:
Alter bufferpool ibmdefaultbp immediate size 250 AUTOMATIC;
A container is a physical storage device. It can be identified by the Directory Name, device name, or file name.
You can allocate containers to a tablespace. A single tablespace can span multiple containers, but each container can only belong to one tablespace.
For Automatic Storage databases, there are two types of storage when creating tablespaces:
(1) DB2 memory management (Automatic Storage)
(2) manual Memory Management
If the new tablespace uses DB2 to manage memory (Automatic Storage), The tablespace management varies depending on the type of the tablespace to be created. When the tablespace type is normal or large, it is automatically created as a database management space (DMS). When its tablespace type is system temporary or user temporary, it is automatically created as system management space (SMS ). With Automatic Storage, you no longer need to worry about how to add containers and monitor the growth of containers. Automatic Storage automatically increases the size of tablespaces on disks and file systems.
If the created tablespace uses manual memory management, its space management system can manage the space (SMS) and database management space (DMS) in two ways. For tablespaces that use the automatic storage function, the container and space management are completely determined by the DB2 database manager. Therefore, the system management space (SMS) and database management space (DMS) it is used only in tablespaces that use manual memory management. It is not directly used in tablespaces that use the automatic storage function. Similarly, the definition and Management of containers are directly used only in tablespaces that use manual memory management. The containers in tablespaces that use the automatic storage function are completely determined by the DB2 database manager.