Storage and Buffer Management

Storage and Buffer Management

The data of a database generally exists in secondary storage; in today's computer systems "secondary storage" generally means magnetic disk. However, to carry out any useful operation on data, that data must be in main memory. It is the job of the storage manager to control the placement of data on disk and its movement between disk and main memory.

In a simple database system, the storage manager might be nothing more than the file system of the underlying operating system. However, for efficiency purposes, DBMS's generally control storage on the disk directly, at least under some circumstances. The storage manager keeps track of the location of files on the disk and gets the block or blocks containing a file on request from the buffer manager. Recall that disks are generally divided into disk blocks, which are regions of contiguous storage containing a large number of bytes, perhaps 212 or 214 (about 4000 to 16,000 bytes).

The buffer manager is responsible for partitioning the available main memory into buffers, which are page-sized regions into which disk blocks can be transferred. Thus, all DBMS components that need information from the disk will interact with the buffers and the buffer manager, either directly or through the execution engine. The kinds of information that various components may need include:

1. Data: the contents of the database itself.

2. Metadata: the database schema that describes the structure of, and constraints on, the database.

3. Statistics: information gathered and stored by the DBMS about data properties such as the sizes of, and values in, various relations or other components of the database.

4.  Indexes: data structures that support efficient access to the data.

A more complete discussion of the buffer manager and its role appears in "Buffer Management".