An index can provide significant performance gains for query execution. You create and maintain indexes on the cache server.
A query run without an index iterates through every object in the collection on the cache server. If an index is available that matches part or all of the query specification, the query iterates only over the indexed set, and query processing time can be reduced.
When you create your indexes on the cache server, remember that indexes incur maintenance costs as they must be updated when the indexed data changes. An index that requires many updates and is not used very often may require more system resources than no index at all. Indexes also consume memory. For information on the amount of memory used for indexes, see the system configuration information in the Pivotal GemFire User's Guide.
You can create an index for remote querying declaratively on the cache server in a cache.xml file, as shown in the next example.
<region name="portfolios"> <region-attributes . . . > <value-constraint>cacheRunner.Portfolio</value-constraint> </region-attributes> <index name="myFuncIndex"> <functional from-clause="/portfolios" expression="status"/> </index> <index name="myPrimIndex"> <primary-key field="id"/> </index> <entry> . . .For detailed information about working with indexes configured on a cache server, see the section Working with Indexes in the GemFire User's Guide.