You can use the following attributes to configure the HashIndex plug-in.
When the GlobalIndexEnabled property of HashIndex is set to true, the global index function of HashIndex is enabled to support the MapGlobalIndex interface on top of any HashIndex configuration. It provides an efficient way to find data in large partitioned environment.
<bean id="MapIndexPlugin"
className="com.ibm.websphere.objectgrid.plugins.index.HashIndex">
<property name="Name" type="java.lang.String" value="CODE"
description="index name" />
<property name="AttributeName" type="java.lang.String" value="employeeCode"
description="attribute name" />
<property name="GlobalIndexEnabled" type="boolean" value="true"
description="true for global index" />
</bean>
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 might 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 Using a composite index.
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. For more information, see Query optimization using indexes.
For non-entity maps, when the POJOKeyIndex property of HashIndex is set to true, the HashIndex is a key HashIndex and the key part of entry are used for indexing. When the AttributeName property of HashIndex is not specified, the whole key is indexed; otherwise, the key HashIndex can only be a single-attribute HashIndex.
For example, adding the following property into the preceding sample causes the HashIndex to become key HashIndex because the POJOKeyIndex property value is true.
<property name="POJOKeyIndex" type="boolean" value="true"
description="indicates if POJO key HashIndex" />
In the preceding key index example, because the AttributeName property value is specified as employeeCode, the indexed attribute is the employeeCode field of the key part of map entry. If you want to build key index on the whole key part of map entry, remove the AttributeName property.
When the RangeIndex property of HashIndex is set to true, the HashIndex is a range index and can support the MapRangeIndex interface. A MapRangeIndex implementation supports functions to find data using range functions, such as greater than, less than, or both, while a MapIndex supports equals functions only. 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 preceding sample is a range HashIndex because the RangeIndex property value is true.
The following table provides a summary for using 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 |
Defining indexes 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 might have a performance impact on transactional map operations.