Scalable Database Server, HiRDB Version 8 Description

[Contents][Glossary][Index][Back][Next]

3.4.1 Basic structure of an index

An index consists of a key and key values. A key is the column name of an indexed column. The values in the column are called the key values. Creating an index for a column that will be used as the basis for retrievals from the table will improve the table's retrieval performance.

It is recommended that indexes be created for the following types of columns:

Indexes provided by HiRDB have a B-tree structure. The highest stage of an index in a B-tree structure is called a root page; the lowest stage is called a leaf page; a page in the middle is called a middle page. Root pages and middle pages point to pages at lower stages. A leaf page has a key value for each index page and its address.

Figure 3-21 shows the B-tree structure of an index.

Figure 3-21 B-tree structure of an index

[Figure]

Explanation
This is a B-tree structure index. The index is created in Step 3 on the basis of the product code column, PCODE is the key, and 101L to 671M are key values.
Organization of this subsection
(1) Single column index and multicolumn index
(2) Optimizing based on cost
(3) Index definition

(1) Single column index and multicolumn index

An index can be based either on a single column or on multiple columns (multicolumn index). A single column index is created by indexing the values in a single column of a table. A single column index is appropriate for retrievals that require a single column as the key. A multicolumn index is created by indexing the values in more than one column of a table. A multicolumn index is appropriate for the following purposes:

(2) Optimizing based on cost

When multiple indexes have been created for a table, HiRDB selects and uses the index that has the least access cost and that it evaluates as being optimal for the conditions specified for the retrieval. This process in which HiRDB selects an index based on an evaluation of optimality is called optimizing based on cost. HiRDB evaluates the following access costs:

HiRDB performs optimizing based on cost in order to improve table retrieval performance. Even when an SQL with retrieval conditions specified is executed, table retrieval performance does not deteriorate. This means that it is possible to create UAPs without being concerned about index access priority. However, in order for HiRDB to use the optimal index, indexes must have been defined for those columns for which retrieval conditions are specified.

(3) Index definition

The CREATE INDEX definition SQL is used to specify the columns in a table that are to be indexed. For details about design considerations related to indexes, such as index definition for retrieval performance improvement, see the HiRDB Version 8 Installation and Design Guide.