WebSphere eXtreme Scale Administration Guide > Configure WebSphere eXtreme Scale
Configure the HashIndex
The HashIndex plug-in supports both the MapIndex and MapRangeIndex interfaces. Defining and using indexes properly can significantly improve query performance.
The following attributes can be used to configure HashIndex using either the ObjectGrid deployment descriptor XML file or a programmatic approach:
- Name: The name of the index. The name must be unique for each map. The name is used to retrieve the index object from the ObjectMap instance for the BackingMap.
- AttributeName: The comma-delimited names of the attributes to index. For field-access indexes, the attribute names are equivalent to the field names. For property-access indexes, the attribute names are the JavaBean-compatible property names. If there is only one attribute name, the HashIndex is a single attribute index, and if this attribute is a relationship, it is also a relationship index. If multiple attribute names are included in the attribute names, the HashIndex is a composite index.
- FieldAccessAttribute: Used for non-entity maps. If true, the object is accessed using the fields directly. If not specified or false, the attribute's getter method is used to access the data.
- POJOKeyIndex: Used for non-entity maps. If true, the index will introspect the object in the key part of the map. This is useful when the key is a composite key and the value does not have the key embedded within it. If not specified or false, then the index will introspect the object in the value part of the map.
- RangeIndex: If true, range indexing is enabled and the application can cast the retrieved index object to the MapRangeIndex interface. If the RangeIndex property is configured as “false”, the application can only cast the retrieved index object to the MapIndex interface.
Single-attribute HashIndex vs. composite HashIndex
When the AttributeName property of HashIndex includes multiple attribute names, the HashIndex is a composite index. Otherwise, if it includes only one attribute name, it is a single-attribute index. For example, the AttributeName property value of a composite HashIndex may be "city,state,zipcode”. It includes three attributes delimited by commas. If the AttributeName property value is only “zipcode” that only has one attribute, it is a single-attribute HashIndex.
Composite HashIndex provides an efficient way to look up cached objects when search criteria involve many attributes. However, it does not support range index and its RangeIndex property must set to “false”.
For more information, see Composite HashIndex.
Relationship HashIndex
If the indexed attribute of single-attribute HashIndex is a relationship, either single- or multi-valued, the HashIndex is a relationship HashIndex. For relationship HashIndex, the RangeIndex property of HashIndex must set to “false”.
Relationship HashIndex can speed up queries that use cyclical references or use the IS NULL, IS EMPTY, SIZE and MEMBER OF query filters. See query optimization using indexes in the Programming Guide.
Range HashIndex
When the RangeIndex property of HashIndex is set to “true”, the HashIndex is a range index and can support the MapRangeIndex interface. A MapRangeIndex supports functions to find data using range functions, such as greater than, less than, or both, while a MapIndex only supports equals functions. For a single-attribute index, the RangeIndex property can be set to “true” only if the indexed attribute is of type Comparable. If the single-attribute index will be used by query, the RangeIndex property must set to “true” and the indexed attribute must be of type Comparable. For relationship HashIndex and composite HashIndex, the RangeIndex property must set to “false”.
The following is a summary for using range index.
Table 1. Support for range index HashIndex type Supports range index Single-attribute HashIndex: indexed key or attribute is of type Comparable Yes Single-attribute HashIndex: indexed key or attribute is not of type Comparable No Composite HashIndex No Relationship HashIndex No
Query optimization using HashIndex
Define and using indexes properly can significantly improve query performance. WebSphere eXtreme Scale queries can use built-in HashIndex plug-ins to improve performance of queries. Although using indexes can significantly improve query performance, it may have a performance impact on transactional map operations.
Parent topic
Configure WebSphere eXtreme Scale