Space Query Plan for XAP
Space Query Plan for XAP
Take a look at XAP's new Space Query Plans, allowing developers to focus on both results on performance. Read on to find out more!
Join the DZone community and get the full member experience.Join For Free
Databases are better when they can run themselves. CockroachDB is a SQL database that automates scaling and recovery. Check it out here.
XAP is being developed tirelessly and we are pleased to introduce one of our newest features, the Space Query plan for XAP.
It brings with it a plethora of information that can be extracted from queries run from within the live environment itself.
The Space Query plan helps stop developers falling into the pitfall of focusing only on results and not performance. A key part of application management today, it should not be neglected.
What Is Space Query Plan?
Just producing an application that allows access to the right information at the right time for users isn’t enough. The real benefit comes from speed and efficiency of these types of system interrogations, and with Space Query, we are giving our customers a way to improve on both of these through the use of Explain Plan reporting. Monitoring of performance in a live environment, without placing excess strain on the system itself, is an invaluable tool when looking to drive application and cost efficiencies.
Explain Plan is not a new feature, as anyone in the DB world knows; however, by introducing this type of query management into our IMC system the possibilities for developers have grown immeasurably.
Want to test it out? Download XAP and give it a whirl.
What Does This Mean and How Can I Utilize It?
Inefficient queries can seriously slow down the execution of any application, no matter how fast the computing environment is. With Space Query now being available in XAP, these types of queries can be targeted and amended with cleaner, more responsive applications.
Currently, this is available to run against extended match or compound queries, and each type will yield a slightly different set of information. It can be used to help answer questions such as, "Which index has been used and how many entries have been scanned to get the appropriate result?" or to identify which specific conditions were checked against.
Space Query Plan in Action
To run this command you simply need to follow three easy steps:
- Use .withExplainPlan() to indicate a query should be executed with an explain plan.
- Execute the query as usual.
- Use .getExplainPlan() to get the result, and print it.
SQLQuery query = new SQLQuery(MyPojo.class, “price > 1000”) .withExplainPlan(); Object result = gigaSpace.read(query); System.out.println(query.getExplainPlan());
What you will end up with is a report detailing steps the query has run, query parse trees, indexing information, and scanning information. All of these are presented in an easy-to-read format that can then be analyzed to find out where a query may be putting unnecessary load onto an application.
Let’s take an extended match query for example and see what this type of report might look like:
Here, you can clearly see each stage of the query: where the data has been pulled from, how many partitions and entries were scanned, and then the exact steps taken within the query tree.
As you can imagine, this type of information is invaluable and allows the focus to shift from output to performance within the production environment.
Monitoring of this information can provide easy insight into whether your application may be querying too many entries or without proper indexing within the space for example. By amending or eradicating these types of queries as appropriate, or changing indexes of areas, for example, operational performance can be greatly increased without the need for more computing power.
Published at DZone with permission of Aharon Moll , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.