Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Adding or deleting indexes

Indexes and index segments are key-based search tools that make record seeking faster and more efficient. An index is a mapping table that contains keys describing certain records and pointers to those records. An index segment describes the table field from which the keys are used.

Indexes are added to the table definition in the order they are declared. The c‑treeVCL/CLX table components also includes a set of functions that will allow an index to be deleted from the table index definition.

AddIndex() adds a new index at the end of the table index definition. For each index added to the table, one or more index segments define which field combination forms a particular index. AddSegment() adds segments to an index.

The valid c-treeDB/c-treeVCL index types are:

c-treeDB
Index Type

c-treeDB .NET
Index Type


Description

CTINDEX_FIXED

FIXED_INDEX

Fixed-length key

CTINDEX_LEADING

LEADING_INDEX

Fixed-length keys that are likely to have leading character duplication among the key values

CTINDEX_PADDING

PADDING_INDEX

Variable-length keys for which not much leading character duplication is expected.

CTINDEX_LEADPAD

LEADPAD_INDEX

Variable-length keys for which much leading character duplication is expected.

CTINDEX_ERROR

ERROR_INDEX

Index type error.

CTINDEX_DFRIDX

DFRIDX_INDEX.

Indicates a deferred index (V11 and later).

CTINDEX_NOMOD

NOMOD_INDEX

Indicates an index with unmodifiable ISAM and c-treeDB keys (V11 and later).

CTINDEX_BCKLOAD

BCKLOAD_INDEX

Perform initial key load in background.
(V11.7 and later)

CTINDEX_VARIABLE

VARIABLE_INDEX

Node-level compression with trailing spaces and metadata compression to fit more in each page block

CTINDEX_VARIABLE_RLE

VARIABLE_RLE_INDEX

Use sRLE key compression for shorter index entries / smaller index files

Note: c-treeDB .NET Index Key Types are defined in the KEY_TYPE enum.

Deferred Indexing (V11 and later)

The c-treeDB add, delete, and update operations perform key insert and deletes on every index associated with a data file:

  • a record add inserts a key value for each associated index.
  • a record delete deletes a key value for each associated index.
  • a record update deletes the old key and inserts the new key for each associated index (for those keys whose values changed).

However, each additional index operation can impose measurable performance loss, especially when numerous indexes are involved. If these immediate key operations could be held off for a period of time, applications can gain substantial performance in many circumstances. In V11 (and later), FairCom addressed these challenges with deferred maintenance modes. By delaying select index operations, applications can quickly create and/or update files with large numbers of indexes very quickly.

Background Loading (V11.7 and later)

ctdbCheckIndexBackgroundLoad() function can be used to monitor the status of the index loading on tables.

See Also:

NAV (c-treeDB) API Variable Length Keys with Compression

The add and insert segment methods require a segment mode as the last parameter. Please refer to the section below describing the valid segment modes. An index can be deleted from the table index definition by calling DeleteIndex().

TOCIndex