6.5. Explaining Query Plans

Given a data store and a query, you can ask GeoMesa to explain its plan for how to execute the query:

dataStore.getQueryPlan(query, explainer = new ExplainPrintln);

Instead of ExplainPrintln, you can also use ExplainString or ExplainLogging to redirect the explainer output elsewhere.

For enabling ExplainLogging in GeoServer, see Logging Explain Query Planning. It may also be helpful to refer to GeoServer’s Advanced log configuration documentation for the specifics of how and where to manage the GeoServer logs.

Knowing the plan – including information such as the indexing strategy – can be useful when you need to debug slow queries. It can suggest when indexes should be added as well as when query-hints may expedite execution times.