Home page  
Help >
Indexing
Version 7.11
1.1 Indexed Fields

An index is a special structure that facilitates rapid queries on specific field values.

Thunderbolt uses balanced binary trees as the basis for its indexing structures.

1.2 Index Declarations

An indexed field is declared in the Data Base Definition by appending the keyword KEY after the data type specification. Any data type except the MEMO data type can be declared as an index. For alphanumeric fields (data type X), the length of an indexed field cannot exceed 256 characters.

If a field occurs in more than one table, each instance of the field must have a KEY declaration if that instance is to be included in the index. [It is permissible to have one or more instances of a keyed field that are not keyed.]

1.3 Key Qualifiers

Additional key-qualifiers can be specified after the KEY keyword to modify the behavior of an index.

1.3.1 The Primary Qualifier

The Primary qualifier specifies that values of the subject field are unique within the subject table. However, there is no enforcement of this restriction. It can be applied only to one instance of a keyed field.

1.3.2 The Sensitive Qualifier

The Sensitive qualifier causes an index to retain its upper/lower case attributes. The default behavior for an index is that case attributes are ignored. The Sensitive qualifier applies to all instances of a field where the field is declared a key.

1.3.3 The RealTime Qualifier

The RealTime qualifier creates an index that is optimized for rapid updates. The RealTime qualifier applies to all instances of a field where the field is declared a key. A field cannot have both RealTime and Standard qualifiers.

1.3.4 The Standard Qualifier

The Standard qualifier is the opposite of RealTime; this is the default. The Standard qualifier applies to all instances of a field where the field is declared a key. A field cannot have both RealTime and Standard qualifiers.

1.3.5 The Discrete Qualifier

The Discrete qualifier creates an index with separate index files for each key. The Discrete qualifier applies to all instances of a field where the field is declared a key. A field cannot have both Discrete and Integral qualifiers.

1.3.6 The Integral Qualifier

The Integral qualifier is the opposite of Discrete; it creates an index that shares common index files with other Integral keys; this is the default. The Integral qualifier applies to all instances of a field where the field is declared a key. A field cannot have both Discrete and Integral qualifiers.

1.3.7 The External Qualifier

The External qualifier specifies that an index is constructed from external data. The External qualifier applies to all instances of a field where the field is declared a key.

An External-declared index is sometimes called a User Defined Index  because the contents of the index are controlled by the user.

For an External-declared index, the initial index build is accomplished with the STRUCTURE command with the USING clause. The incremental index build of newly inserted records can be accomplished with the STRUCTURE command with the USING clause; or with the Thunderbolt API function ddlUdiStruct(). The index update of modified or deleted records is accomplished with the ddlUdiStruct() function.

The CONSTRUCT command and the STRUCTURE command without the USING clause (either globally or specifically) will not act on an External-declared index. The DESTRUCT command, when used globally, will not destroy an External-declared index; the exception is that the /Z option enables the DESTRUCT command to act on External-declared indexes.

Also, record inserts, changes and deletes will not modify an External-declared index.

1.4 Key Qualifier Default Overrides

The DataBase Definition DBOPTION Statement has two options for setting default key qualifiers. The statement
DBOPTION I
sets Integral as the default key qualifier. The default can be over-ridden for specific fields with explicit Discrete qualifiers.

The statement
DBOPTION T
sets Discrete as the default key qualifier. The default can be over-ridden for specific fields with explicit Integral qualifiers.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.