This page introduces the various DB2 storage objects to store data.

Problem Description


From the user's perspective, a database is a collection of tables that are usually related in some way. But data storage is a little more complicated than that. An understanding of the same is vital towards building a performance intensive database.

Operation


The physical implementation of a database relies on the storage objects of a database.

Solution


Storage objects control where data is physically stored and how data is moved between storage and memory during normal operation. Three types of storage objects are used. They are:

  1. Bufferpools

    A buffer pool is a section of memory that has been reserved for the sole purpose of caching data pages as they are read from physical storage. Whenever data is needed to resolve a query, the page that the data is stored on (data is stored in sections called pages) is located in physical storage and transferred to a buffer pool, where it is then read and/or modified. The pages read stay in memory. When a page of data is retrieved, the DB2 Database Manager uses a set of heuristic algorithms to try to determine which pages will be needed next, those pages are retrieved as well (referred to as prefetching). Retaining all pages loaded and prefetching are done to improve overall performance; data can be accessed much faster when it is stored in memory than when it is stored on disk.

  2. Tablespaces

    Tablespaces are used to control where data is physically stored and to provide a layer of indirection between a table and one or more containers in which the table's data actually resides. A single tablespace can span many containers, but each container can only belong to one tablespace. Tables form logical storage units residing in the tablespaces.

  3. Containers

    A container is a physical storage device. It can be identified by a directory name, a device name, or a file name. A container is assigned to a table space. A tablespace can span many containers. The containers further contain :