Querying Partitioned Regions
Geode allows you to manage and store large amounts of data across distributed nodes using partitioned regions. The basic unit of storage for a partitioned region is a bucket, which resides on a Geode node and contains all the entries that map to a single hashcode. In a typical partitioned region query, the system distributes the query to all buckets across all nodes, then merges the result sets and sends back the query results.
The following list summarizes the querying functionality supported by Geode for partitioned regions:
- Ability to target specific nodes in a query. If you know that a specific bucket contains the data that you want to query, you can use a function to ensure that your query only runs the specific node that holds the data. This can greatly improve query efficiency. The ability to query data on a specific node is only available if you are using functions and if the function is executed on one single region. In order to do this, you need to use
Query.execute(RegionFunctionContext context)
. See the Java API and Querying a Partitioned Region on a Single Node for more details. - Ability to optimize partitioned region query performance using key indexes. You can improve query performance on data that is partitioned by key or a field value by creating a key index and then executing the query using use
Query.execute(RegionFunctionContext context)
with the key or field value used as filter. See the Java API and Optimizing Queries on Data Partitioned by a Key or Field Value for more details. Ability to perform equi-join queries between partitioned regions and between partitioned regions and replicated regions. Join queries between partitioned region and between partitioned regions and replicated regions are supported through the function service. In order to perform equi-join operations on partitioned regions or partitioned regions and replicated regions, the partitioned regions must be colocated, and you need to use the need to use
Query.execute(RegionFunctionContext context)
. See the Java API and Performing an Equi-Join Query on Partitioned Regions for more details.Optimizing Queries on Data Partitioned by a Key or Field Value