When you execute SQL statements to query data, you can improve the query efficiency by using a suitable index selection policy and computing pushdown. This topic describes how to use index selection policy and computing pushdown to optimize the query efficiency.
Index selection policy
Tablestore can store large volumes of structured data and supports various types of index schemas for accelerated query and analytics in different scenarios. When you execute SQL statements to query data in a data table, you can create a secondary index or search index for the data table to accelerate the query. For more information, see Index selection policy.
When you use a mapping table created for a data table to query data, the index selection policy can be automatic selection or manual selection.
Automatic selection policy: Tablestore automatically selects the data table, secondary index, or search index to query data.
Manual selection policy: You must explicitly specify the data table, secondary index, or search index that you want to use to query data.
When you use a mapping table that is created for a secondary index or search index to query data, you can only query the data columns that are contained in the secondary index or search index.
Computing pushdown
Search indexes provide features such as conditional filtering, aggregation, and sorting. After you create a search index, the system can make full use of the computing capability of the search index and push some SQL computing tasks down to the search index for execution. This eliminates the need for full table scans and improves computing efficiency. For more information, see Computing pushdown.