Caché Class Definition Reference
Index Definitions
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Describes the structure of an index definition.
Introduction
An index is a structure maintained by a persistent class that is intended to be used to optimize queries and other functions. These indices are automatically maintained whenever INSERT, UPDATE, or DELETE SQL-based operations are carried out against the database; likewise for object-based actions. The SQL Query Processor makes use of available indices when preparing and executing SQL queries.
You can add index definitions to persistent classes. They are not meaningful in other kinds of classes.
Details
An index definition has the following structure:
/// description
Index name On property_expression_list [ keyword_list ];
Where:
For example, the following class definition defines two properties and an index based on each of them:
Class MyApp.Student Extends %Persistent 
{

Property Name As %String;

Property GPA As %Float;

Index NameIDX On Name;

Index GPAIDX On GPA;
}
See Also