Search indexes support 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 about search indexes, see Overview.
Scenarios
If a search index contains data columns involved in SQL statements, the SQL engine reads data by using the search index and pushes down the operators that are supported by the search index. For example, a table named exampletable contains columns a, b, c, and d. A search index of the table contains the b, c, and d columns that are indexed. The SQL engine reads data by using the search index only when the b, c, and d columns are involved in SQL statements.
SELECT a, b, c, d FROM exampletable; /* The search index does not contain the a, b, c, or d columns. The SQL engine reads data by scanning the entire table and does not push down operators. */
SELECT b, c, d FROM exampletable; /* The search index contains the b, c, and d columns. The SQL engine reads data by using the search index and pushes down operators. */
Prerequisites
A search index is created. For more information, see Create a search index.
A mapping table is created. For more information, see Create a mapping table for a table or Create mapping tables for search indexes.
Operators that can be pushed down
The following table describes the operators that can be pushed down to search indexes for execution in SQL statements.
Type | Operator | Pushdown limit |
Logical operators | AND and OR | The NOT operator cannot be pushed down. |
Relational operators | =, !=, <, <=, >, >=, and BETWEEN ... AND ... | Operator pushdown is supported only for comparison between data columns and constants. Operator pushdown is not supported for comparison between data columns.
|
Aggregate functions |
| An aggregate function can aggregate all data or data in a GROUP BY group. Operator pushdown is supported only when the aggregate function supports pushdown and the function parameter is a data column.
|
LIMIT |
| Operator pushdown is supported only when the parameter in the ORDER BY clause is a data column.
|