tibasIndexDef_Create()

Creates a secondary index definition.

Declaration

tibas_status tibasIndexDef_Create(
    tibasIndexDef* indexDef,
    char*          indexName,
    char*          fieldNames)

Parameters

Parameter Description
indexDef Pointer to an IndexDef that is created.
indexName Specifies the name of the secondary index.
fieldNames Pointer to a list of comma-separated values that specifies the fields to be used for the secondary index.

Remarks

Use the tibasIndexDef_Create() function to create a secondary index.

Secondary indexes provide a way to search for data that supplements the primary index that you create with the tibasKeyDef_Create()function. Indexes are built when spaces are created (or loaded) and use memory to help locate matching tuples faster than it takes to iterate through a long record. Secondary indexes can speed up searches significantly.

By default, tibasIndexDefCreate() assigns the index type for the index the value TIBAS_INDEX_HASH. You can use the tibasIndexDef_SetIndexType() function to change the index to TIBAS_INDEX_TREE if you want to use a tree index.

After you create the index by calling tibasIndexDef_Create(), you must add it to the spaceDef for the space by calling the tibasSpaceDef_AddIndexDef()function. Then, when you join a space, you pass the spaceDef to the tibasMetaspace_DefineSpace() function.