User Level
System Administrator
User LevelSystem Administrator SyntaxThe command uses this syntax.
Add IndexAn index is created with the add index command. Syntax
Attribute ClauseThis clause assigns attributes to the index. These attributes must be previously defined with the add attribute command (for more information, see MQL Concepts: Defining an Attribute), and cannot include multiline attributes. Use the Attribute clause if only attributes will be included in the index. To include basic properties, see Field FIELD_VALUE. Multi-line attributes cannot be added to an index. A maximum of 25 items can be placed in a single index. However, a typical index will have between 2 and 5 items. For example:
In this syntax, attribute names are listed separated by a comma but no space, with the keyword “attribute” used only once. Quotes are needed for names that include spaces. Generally, all attributes placed in an index should exist in the same type definitions. For example, if an index is created with the attributes Cost, Weight, and Quantity, then all relationships or types that reference Cost, Weight, or Quantity should reference all three of them. If there is a type or relationship that references only some of the attributes in an index, a warning is generated. You can proceed with the index creation, but it will take longer to create an index where this completeness test fails. For expands, 3DSpace looks for and uses an index that is associated with relationships; that is, an index that has a relationship attribute as the first item in it. There are special rules that apply when including a long string attribute in an index. Since a string attribute can be any length, and the index tables are constructed using fixed length columns, string attributes are truncated to 251 characters when written to an index table. This means that only the first 251 characters are searchable on the index. As mentioned below, the same applies to descriptions, but these fields are truncated (and therefore searchable) on the first 2040 characters. Only the first 251 characters of string attributes and 2040 characters of descriptions are indexed. This should not really be a concern, since string attributes designed to hold this much data are generally defined as “multi-line” and multi-line attributes cannot be included in an index. Field FIELD_VALUE Field
For example:
In this syntax, attributes names are in square brackets and include the keyword attribute with each one. Also, there is a space but no comma between fields. You can assign any combination of basic properties (type, name, revision, description, owner, locker, policy, creation date, modification date, and current state) and defined attributes to the index, except for multiline attributes. A typical index will have between 2 and 5 items. While it is possible to have more, most indices should have no more than 5 items. The first item in the index determines which objects go into the index table. Also, only queries and expands that include the first item will ever use it. If the first item in an index is an attribute, then all business objects and relationships that have that attribute will be added to the index table. If the first item in an index is a basic property, then all business objects (since all business objects have basics) and no relationships are added. Care must be taken when adding an index that has a basic property as its first field. If there are many such indices, performance will suffer, and storage requirements might exceed expectations. Indices defined with a basic property first include all business objects and require maximum storage facilities. Therefore, adding basic properties first in an index should be limited to those that include only basic properties. Generally, all attributes placed in an index should exist in the same type definitions. For example, if an index is created with the attributes Cost, Weight, and Quantity, then all relationships or types that reference Cost, Weight, or Quantity should reference all three of them. If there is a type or relationship that references only some of the attributes in an index, a warning is generated. You can proceed with the index creation, but it might take longer to create an index where this attribute completeness test fails. You cannot include Description in an index in SQL Server environments. The use of Description in an index should be avoided; the advanced search option indexes descriptions much more efficiently. Size Clause You can define a unique size restriction up to 2KB for each string based
Unique ClauseAn index can be defined as “unique.” When this is specified, a unique constraint is placed on the index table in the database schema. This allows a very efficient mechanism for implementations that want to require unique combinations of values on business objects. The unique setting only applies to objects within a single vault. Shortdescription ClauseThe shortdescription clause lets you create an index for the short description. History Clause The Copy IndexYou can copy an index based on an existing index, and change the definition of the new index as part of the copy process.
Modify IndexAfter an index is defined, you can change the definition with the modify index command. This command lets you add or remove defining clauses and change the value of clause arguments.
Enable IndexTo enable an index, use the following command.
As soon as you enable the index, a table is created in every vault. (The tables are named in the form ixXXXXXX_XXXXX, created by concatenating a prefix associated with the index and a suffix associated with the vault. The prefix can be obtained from print index command and the suffix from the print vault command.) If you then disable the index, or add or remove items, these tables are dropped. Also, if you add an attribute to a type or relationship that is part of an index, the index is disabled. To use the index, it must be re-enabled. For example, to enable the index named “Index for Finance queries,” enter the following MQL command:
Creating and enabling indices are not appropriate actions to be performed within explicit transaction boundaries, particularly if additional operations are also attempted before a commit. Disable IndexYou should disable indices when performing bulk loading or bulk updating of data. To disable a defined index, use:
Validate IndexSince up-to-date database statistics are vital for optimal query performance, after enabling an index you should generate and add statistics to the new database tables. You can use one of these formats to issue the Validate Index command:
This command assumes statistics are already up-to-date for all other tables. Delete IndexIf an index is no longer required, you can delete it with the Delete index command.
This command searches the list of indices. If the name is not found, an error message is displayed. If the name is found, the index is deleted. For example, to delete the index named “Index for Finance queries,” enter the following command:
ExampleWhen you create an index, the mxindex table is updated. The ix tables are not created until the index is enabled. For example:
|