This topic covers considerations for improving query performance.
Some general performance tips:
- Improve query performance whenever possible by creating indexes. See Tips and Guidelines on Using Indexes for some scenarios for using indexes.
- Use bind parameters for frequently used queries. When you use a bind parameter, the query is compiled once. This improves the subsequent performance of the query when it is re-run. See Using Query Bind Parameters for more details.
- When querying partitioned regions, execute the query using the FunctionService. This function allows you to target a particular node, which will improve performance greatly by avoiding query distribution. See Querying a Partitioned Region on a Single Node for more information.
- Use key indexes when querying data that has been partitioned by a key or field value. See Optimizing Queries on Data Partitioned by a Key or Field Value.
- The size of a query result set depends on the restrictiveness of the query and the size of the total data set. A partitioned region can hold much more data than other types of regions, so there is more potential for larger result sets on partitioned region queries. This could cause the member receiving the results to run out of memory if the result set is very large.