Collaboration diagram for B+-Tree Indexes:
![]() |
The number of key-value pairs that an index can hold is limited by the space available on the volume containing the index. The combined sizes of the key and value must be less than or equal to max_entry_size, which is a function of the page size, and is such that two entries of this size fit on a page along with all the page and entry metadata. See sm_config_info_t and ss_m::config_info.
The minimum size of a B-Tree index is 8 pages (1 extent).
A variety of locking protocols is supported:
The key description is a null-terminated string as follows:
<key_decription> ::= <fixed_len_part>* <variable_len_part> | <fixed_len_part>+ <fixed_len_part> ::= <type> <len> <variable_len_part> ::= <type> '*' <len> <type> ::= 'i' | 'u' | 'f' | 'b' | 'I' | 'U' | 'F' | 'B' <len> ::= [1-9][0-9]*
The fixed-length parts (if present) consist of a type and a length.
The variable-length part (if present) consists of a type and a length separated by an asterisk, which is what distinguishes a variable-length from a fixed-length part.
Types and permissible lengths are:
A capital letter indicates that the key part may be compressed. Only prefix compression is implemented, so it makes sense to compress if the first part of the key is compressible.
Examples:
Functions | |
static rc_t | ss_m::create_index (vid_t vid, ndx_t ntype, store_property_t property, const char *key_desc, concurrency_t cc, stid_t &stid) |
Create a B+-Tree index. | |
static rc_t | ss_m::create_index (vid_t vid, ndx_t ntype, store_property_t property, const char *key_desc, stid_t &stid) |
Create a B+-Tree or R*-Tree index. | |
static rc_t | ss_m::destroy_index (const stid_t &iid) |
Destroy a B+-Tree index. | |
static rc_t | ss_m::create_assoc (stid_t stid, const vec_t &key, const vec_t &el) |
Create an entry in a B+-Tree index. | |
static rc_t | ss_m::destroy_assoc (stid_t stid, const vec_t &key, const vec_t &el) |
Remove an entry from a B+-Tree index. If your index is non-unique (i.e., it may contain multiple entries per key), use destroy_all_assoc. | |
static rc_t | ss_m::destroy_all_assoc (stid_t stid, const vec_t &key, int &num_removed) |
Destroy all entries associated with a key in a B+-Tree index. | |
static rc_t | ss_m::find_assoc (stid_t stid, const vec_t &key, void *el, smsize_t &elen, bool &found) |
Find an entry associated with a key in a B+-Tree index. |
static rc_t ss_m::create_index | ( | vid_t | vid, | |
ndx_t | ntype, | |||
store_property_t | property, | |||
const char * | key_desc, | |||
concurrency_t | cc, | |||
stid_t & | stid | |||
) | [static, inherited] |
Create a B+-Tree index.
[in] | vid | Volume on which to create the index. |
[in] | ntype | Type of index. Legitimate values are:
|
[in] | property | Logging level of store. Legitimate values are:
|
[in] | key_desc | Description of key type. See Key Types for details. |
[in] | cc | The locking protocol to use with this index. See smlevel_0::concurrency_t and B+-Tree Indexes. |
[out] | stid | New store ID will be returned here. |
static rc_t ss_m::create_index | ( | vid_t | vid, | |
ndx_t | ntype, | |||
store_property_t | property, | |||
const char * | key_desc, | |||
stid_t & | stid | |||
) | [static, inherited] |
Create a B+-Tree or R*-Tree index.
Destroy a B+-Tree index.
[in] | iid | ID of the index to be destroyed. |
static rc_t ss_m::create_assoc | ( | stid_t | stid, | |
const vec_t & | key, | |||
const vec_t & | el | |||
) | [static, inherited] |
Create an entry in a B+-Tree index.
[in] | stid | ID of the index. |
[in] | key | Key for the association to be created. |
[in] | el | Element for the association to be created. |
static rc_t ss_m::destroy_assoc | ( | stid_t | stid, | |
const vec_t & | key, | |||
const vec_t & | el | |||
) | [static, inherited] |
Remove an entry from a B+-Tree index. If your index is non-unique (i.e., it may contain multiple entries per key), use destroy_all_assoc.
[in] | stid | ID of the index. |
[in] | key | Key of the entry to be removed. |
[in] | el | Element (value) of the entry to be removed. |
static rc_t ss_m::destroy_all_assoc | ( | stid_t | stid, | |
const vec_t & | key, | |||
int & | num_removed | |||
) | [static, inherited] |
Destroy all entries associated with a key in a B+-Tree index.
[in] | stid | ID of the index. |
[in] | key | Key of the entries to be removed. |
[out] | num_removed | The number of entries removed is returned here. |
static rc_t ss_m::find_assoc | ( | stid_t | stid, | |
const vec_t & | key, | |||
void * | el, | |||
smsize_t & | elen, | |||
bool & | found | |||
) | [static, inherited] |
Find an entry associated with a key in a B+-Tree index.
[in] | stid | ID of the index. |
[in] | key | Key of the entries to be removed. |
[out] | el | Element associated with the given key will be copied into this buffer. |
[in] | elen | Length of buffer into which the result will be written. If too small, eRECWONTFIT will be returned. Length of result will be returned here. |
[out] | found | True if an entry is found. |
To locate all entries associated with a non-unique key, you must use scan_index_i, q.v..