Maintaining Indexes (Synchronously or Asynchronously)

Index Maintenance Behavior

Indexes are automatically kept current with the region data they reference. The region attribute IndexMaintenanceSynchronous specifies whether the region indexes are updated synchronously when a region is modified or asynchronously in a background thread. Asynchronous index maintenance batches up multiple updates to the same region key. The default mode is synchronous, since this provides the greatest consistency with region data.

See AttributesFactory.setIndexMaintenanceSynchronous.

This declarative index creation sets the maintenance mode to asynchronous:
<region-attributes index-update-type="asynchronous"> 

Internal Index Structure

RangeIndex and CompactRangeIndex are the two internal data structures that are used to maintain the indexes created on queryable objects.


A CompactRangeIndex is a range index that has simple data structures to minimize its footprint, at the expense of doing extra work at index maintenance. This index does not support the storage of projection attributes.

Currently CompactRangeIndex only supports the creation of an index on a region path. It is selected as the index implementation when the following holds true:
  • Index Maintenance is synchronous.
  • The indexed expression is a path expression.
  • The FROM clause has only one iterator. This implies that there is only one value in the index for each region entry and it is directly on the region values (not supported with keys, entries).


Used whenever CompactRangeIndex cannot be used.

The following are examples when RangeIndex is used.
createIndex("statusIndex","status","/portfolios, positions");
createIndex("secIdIndex","b.secId","/portfolios pf, pf.positions.values b"); 
createIndex("intFunctionIndex","intFunction(pf.getID)","/portfolios pf, pf.positions b");
createIndex("kIndex","pf","/portfolios.keys pf");