Tech

Configure spatial index using Query Entities in Apache Ignite’s NodeJS Thin Client

I am trying to configure a geospatial index for performant intersect querying on an Ignite Cache. I am able to set the field as queryable, and have set the index using the recommended syntax .setIndexes(new QueryIndex("columnName").

However, when I perform an “EXPLAIN SELECT” SqlFieldsQuery on the cache I am seeing .__SCAN instead of the indexed column. I believe this means it is scanning the entire cache instead of using the index, but could not find documentation on this.

'SELECT\n' +
    '    "__Z0"."EXAMPLESTRING" AS "__C0_0",\n' +
    '    "__Z0"."EXAMPLESPATIAL" AS "__C0_1"\n' +
    'FROM "mySpatialGeometryCache"."EXTENDEDPOINT" "__Z0"\n' +
    '    /* mySpatialGeometryCache.EXTENDEDPOINT.__SCAN_ */\n' +
    'WHERE INTERSECTS("__Z0"."EXAMPLESPATIAL", ?1)'

Here is the queryEntity I have configured:

new QueryEntity()
      .setValueTypeName("ExtendedPoint")
      .setFields([
        new QueryField("exampleString", "java.lang.String"),
        new QueryField("exampleSpatial", "java.lang.String"),
      ])
      .setIndexes(new QueryIndex("exampleSpatial"))
  );

I am not getting any errors or console warnings, and I am able to query the exampleSpatial field just fine, but I want to ensure that an index is being used so that it performs best when the cache is at a higher volume.

Similar Posts