This topic lists the requirements for using indexes when querying overflow regions in VMware Tanzu GemFire.
Requirements:
You must use synchronous index maintenance for the region. This is the default maintenance setting.
The index FROM
clause must specify only one iterator, and it must refer to the keys or entry values. The index cannot refer to the region’s entrySet
.
The index data itself is not stored on or overflowed to disk .
Examples:
The following example index creation calls DO NOT work for overflow regions.
// This index will not work on an overflow region because there are two iterators in the FROM clause.
createIndex("secIdIndex", "b.secId","/portfolios pf, pf.positions.values b");
// This index will not work on an overflow region because the FROM clause specifies the entrySet
createIndex("indx1", "entries.value.getID", "/exampleRegion.entrySet() entries");
The following example indexes will work for overflow regions.
createIndex("pkidIndex", "p.pkid", "/Portfolios p");
createIndex("indx1", "ks.toString", "/portfolio.keySet() ks");
The same working examples in gfsh:
gfsh> create index -name="pkidIndex" --expression="p.pkid" --region="/Portfolios p"
gfsh> create index -name="indx1" --expression="ks.toString" --region="/portfolio.keySet() ks"