By creating a hash index, you can vastly improve the memory usage of your index. If you are doing equality based queries, your indexing footprint is significantly reduced. As an example, previously when you created an index that contained string fields, copies of the strings were included in the index. By using hash indexes, we ensure that indexed expressions are canonicalized and stored in the index as pointers to the PDX objects lying in the region. In internal test cases we have seen improvements in the 30% range depending on the keys and data being used.
The performance of put operations when using a hash index should be comparable to other indexes or slightly slower. Queries themselves are expected to be slightly slower due to the implementation of hash index and the cost of recalculating the key on request, which is the trade-off for the space savings that using a hash index provides.
QueryService qs = cache.getQueryService();
qs.createHashIndex("myHashIndex", "mktValue", "/exampleRegion");
gfsh> create index --name=myHashIndex --expression=mktValue --region=/exampleRegion
<region name=exampleRegion> <region-attributes . . . > </region-attributes> <index name="myHashIndex" from-clause="/exampleRegion p" expression="p.mktValue" type="hash"/> ... </region>