<index>

The <index> element defines an index on the database table used to store the data for an entity. Guidewire defines this element in the data model metadata files as the <index> XML subelement. This element contains a required subelement, which is <indexcol>.

The <index> element instructs PolicyCenter to create an index on the physical database table. This index is in addition to those indexes that PolicyCenter creates automatically.

An index improves the performance of a query search within the database. It consists of one or more fields that you can use together in a single search. You can define multiple <index> elements within an entity, with each one defining a separate index. If a field is already part of one index, you do not need to define a separate index containing only that field.

For example, PolicyCenter frequently searches non-retired accounts for one with a particular account number. Therefore, the Account entity defines an index containing both the Retired and AccountNumber fields. However, another common search uses just AccountNumber. Since that field is already part of another index, a separate index containing only AccountNumber is unnecessary.

A column used in an index cannot have a length of more than 1000 characters.

Important: In general, the use of a database index has the possibility of reducing update performance. Guidewire recommends that you add a database index with caution. In particular, do not attempt to add an index on a column of type CLOB or BLOB. If you do so, PolicyCenter generates an error message upon resource verification. Regardless of the column type, add a database index only in the PolicyCenter application, not outside of the application.

Attributes of <index>

The <index> element contains the following attributes.

<index>  attribute            

Description

Default

desc

A description of the purpose and use of the index.

None

expectedtobecovering

If true, it indicates that the index covers all the necessary columns for a table that is to be used for at least one operation. For example, search by name is one such operation.

Thus, if true, it indicates that there is to be no table lookup. In this case, use the desc attribute to indicate which operation that is.

false

name

Required. The name of the index. The first character of the name must be a letter. The maximum length for an index name is 18 characters.

IMPORTANT For <subtype> definitions, all index names must be unique between the subtype and supertype. In other words, do not duplicate an index name between the subtype definition in the extensions folder and its supertype in the metadata folder. Otherwise, PolicyCenter generates an error on resource verification.

None

trackUsage

If true, track the usage of this index.

true

unique

Whether the values of the index are unique for each row.
Note:

When you set the unique attribute to true for an index on a subtype entity, PolicyCenter generally sets the attribute to false upon index generation. In this case, the database does not define the index as unique. Rather, PolicyCenter uses an integrity check to ensure that you do not add duplicates through the staging tables and a consistency check to highlight past duplicates.

Exceptional cases arise if the unique attribute is true and either the index consists of only a single column or the index has an ID column. In these cases, the database defines the index as unique.

false

verifyInLoader

If true, then PolicyCenter runs an integrity check for unique indexes before loading data from the staging tables.

true

Subelements of <index>

The <index> element contains the following subelements.

<index>  subelement     

Description

Default

forceindex

Use to force PolicyCenter to create an index if running against a particular database.

This subelement is useful because the index generation algorithm can throw away some declared indexes as being redundant. In some cases, PolicyCenter can require one or more of those indexes to work around an optimization problem.

This subelement contains the following attributes:

  • oracle – If true, force the creation of an index if running against an Oracle database.
  • sqlserver – If true, force the creation of an index if running against a Microsoft SQL Server database.

None

indexcol

Required. Defines a field that is part of the index. You can specify multiple <indexcol> elements to define composite indexes. This subelement contains the following attributes:

  • keypositionRequired. The position of the field within the index. The first position is 1.
  • nameRequired. The column name of the field. This name can be a column, foreignkey, or typekey defined in the entity.
  • sortascending – If true, the default, then the sort direction is ascending. If false, then the sort direction is descending.

The column cannot have a length of more than 1000 characters.

None