Native Queries
You can use native query to improve the query performance. Native queries are run directly on the cache or store provider that is configured in the project CDD. Native querying is supported for Apache Ignite, TIBCO ActiveSpaces and Apache Cassandra.
To use native querying, prefix the usual query with the native-query: string:
native-query: SELECT column1, column2 FROM table_name;
For example, refer to the following native query example with the Apache Ignite as cache provider:
| Original Query | Native Query |
|---|---|
SELECT age, count FROM /Concepts/Common/Customer;
|
native-query: SELECT age, count FROM be_gen_Concepts_Common_Customer;
|
Note:
- The tables must be present internally with the provider in use.
- The native query format must conform to the query syntax of the provider in use.
- Native queries work from both, BQL console and project code.
- Native queries only work for snapshot queries.
- Native queries run on the cache for cache object management mode irrespective of the persistence configuration.
- For limited cache, native queries run on the limited records that are available in the cache.