Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Set the index key type.


CTDBRET ctdbSetIndexKeyType(CTHANDLE Handle, CTDBKEY KeyType)


ctdbSetIndexKeyType() sets the key type for this index. Use ctdbAddIndex() to add an index to a table. Use ctdbGetIndexKeyType() to retrieve the Index key type. The valid key types are listed in c-treeDB API definitions.

Valid keytype values are:

  • CTINDEX_FIXED: Fixed-length key
  • CTINDEX_LEADING: Leading-character compression
  • CTINDEX_PADDING: Padding compression
  • CTINDEX_LEADPAD: Leading and padding compression

Note: Key compression imposes a significant performance impact, especially when deleting records. Use this feature only when absolutely necessary to keep index space requirements to a minimum.

In V11 and later, a new key type, CTINDEX_DFRIDX, has been added to indicate a deferred index.

Another new type, CTINDEX_NOMOD, was added to indicate an index with unmodifiable ISAM and c-treeDB API keys.


ctdbSetIndexKeyType() returns CTDBRET_OK on success, or c-treeDB API C API error on failure.

See also

ctdbAllocIndex(), ctdbGetIndexKeyType()