Examples of query execution plan
You can write some queries using the users
table and
understand how query execution plan is generated.
Description of the
users
table:CREATE TABLE users (
id INTEGER,
firstName STRING,
lastName STRING,
otherNames ARRAY(RECORD(first STRING, last STRING)),
age INTEGER,
income INTEGER,
address JSON,
connections ARRAY(INTEGER),
expenses MAP(INTEGER),
PRIMARY KEY (id)
)
The following index has been created in the
users
table.CREATE INDEX idx_state_city_income on Users(address.state as string,
address.city as string, income)
Some examples of query execution plan :
- Example 1 : Using a covering index in a query plan with only index scans
- Example 2 : Using a covering index in a query plan with index scans and index predicates
- Example 3: Using a non-covering index in a query plan with index scans
- Example 4: Sort the data using a Covering index
- Example 5: Sort the data using a field not part of the index
- Example 6: Group the data using a Covering index
- Example 7: Group data with fields not part of the index