Learn about the DB2 Index Structure

Source: Internet
Author: User

What is the DB2 index structure? This is a problem that many people have mentioned. The following describes the DB2 Index Structure in detail, hoping to give you a deeper understanding of the DB2 index structure.

DB2 Index Structure

In DB2, the index data structure is a B + tree. Tree B organizes its storage blocks into a tree. The tree is balanced, that is, all paths from the roots to the leaves are the same length. Generally, Tree B has three layers: Root, middle layer, and leaf, but it can also be any layer. Typical B + tree structure: at least two pointers in the root node are used. All pointers point to the storage block located at the layer under the B tree. In the leaf node, the last Pointer Points to the next leaf node storage block on the right, that is, the block pointing to the next key value greater than its. Among the other n pointers of the leaf block, at least one pointer is used and points to the data record. Unused pointers can be considered as null pointers and do not point to any place. If the I-th index is used, it points to the record with the I-th key value; in the inner layer node, all n + 1 pointers can be used to point to the lower layer of B. At least one pointer is actually used, but if it is a root node, only at least two pointers are required no matter how many n are used ). If j pointers are used, the block will have J-1 keys set to K1, K2 primary keys, Kj-1. The first pointer points to a part of B. Some records whose key value is smaller than K1 can be found in this part. The second Pointer Points to another part of B. All records whose key value is K1 and smaller than K2 can be in this part. And so on. Finally, the j Pointer Points to another part of the B tree. Some records whose key value is greater than or equal to Kj-1 can be found in this part. Note: Some records whose key values are much smaller than K1 or greater than Kj-1 may not be accessible through this block, but may be accessible through other blocks on the same layer. If we draw B tree in the conventional way, the subnodes of any given node are arranged in the order from the first child node on the left to the last child node on the right. Then, we can see the node of Tree B from left to right at any level, and the key value of the node will appear in the order of non-subtraction.
Index Structure in DB2 Standard table and index management
  Record representation and Data Page 
In DB2, run the command db2dart <dbname>/di/tsi <tabspacesid>/oi <tableid>/ps <N> p/np 1/v y to view the index's physical structure increase understanding of indexes.

Provides you with an in-depth understanding of the DB2 materialized query table.

Rollback of A DB2 partitioned Database

Implementation of DB2 partitioned Database Backup

DB2 logfilsiz parameter settings

Online Implementation of changing the DB2 page size

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.