The PolarDB for MySQL In-Memory Column Index (IMCI) feature is designed to significantly accelerate your analytical processing (AP) queries. To ensure that IMCI correctly accelerates your SQL queries and returns the expected results, review the scope and limits of this feature before you use it.
General limits
Before you use an in-memory column index, ensure that your cluster environment and table schema meet the following requirements:
Storage engine: Columnstore indexes are supported only for tables that use the
InnoDBstorage engine.Temporary tables: You cannot use IMCI to accelerate queries on temporary tables.
Virtual columns: You can create an in-memory column index on a virtual column if the following conditions are met:
Set the
imci_enable_virtual_columncluster parameter toON.NoteThis is a SESSION-level parameter and cannot be modified in the console.
The
order_keyis not specified when the in-memory column index is created.
Virtual column type: You cannot create an in-memory column index for virtual columns of the Spatial type.
For a Multi-master Cluster (Limitless) Edition, you must first change the cluster parameter
loose_polar_enable_imci_with_mmtoON. You can then add a global read-only node for the in-memory column index and use the IMCI feature.
SELECT statement limits
Columnstore indexes only accelerate SELECT queries. If a query statement contains any of the following structures, the query cannot be accelerated by the columnstore index and will degrade to row store execution:
SELECTstatements that include locking reads, such asSELECT ... FOR UPDATEorSELECT ... FOR SHARE.SELECTstatements that contain a window function with a frame definition. For example, usingROWS UNBOUNDED PRECEDINGin theOVER()clause.SELECT time, subject, val, SUM(val) OVER ( PARTITION BY subject ORDER BY time ROWS UNBOUNDED PRECEDING --- Frame definition in a window function, not supported by IMCI ) AS running_total FROM observations;SELECTstatements where a subquery appears in theGROUP BYclause. For example,SELECT SUM(a) FROM t1 GROUP BY (SELECT ... FROM ...) as some_subquery;SELECTstatements where a subquery appears in anORDER BYexpression. For example,SELECT a FROM t1 ORDER BY (SELECT ... FROM ...) as some_subquery;SELECTstatements where a correlated subquery appears in theONcondition of aJOIN. For example,WHERE t1.a in (SELECT t2.a FROM t2 INNER JOIN t3 on t2.a = t3.a AND t2.b > t1.b);SELECTstatements where a subquery contains a window function and its correlated item appears in theHAVINGcondition.SELECTstatements where a subquery contains aUNIONand its correlated item appears in one of the subqueries of theUNION.
Expression and function limits
If a SELECT statement contains any unsupported expressions or functions, the entire query falls back to the row store for execution.
Comparison expressions
Expression | Are columnstore indexes supported? | Notes |
| If the data types of | |
| If the data types of | |
| If the input parameters include both a | |
| If the data types of | |
| If the input parameters include both a | |
| - |
String expressions
Expression | Are columnstore indexes supported? | Notes |
| - | |
| BOOLEAN MODE and NATURAL LANGUAGE MODE are supported. | |
| - | |
| When using IMCI, this function supports only one parameter. It does not support two parameters. |
Encryption and compression expressions
Expression | Are columnstore indexes supported? |
| |
| |
| |
| |
| |
| |
| |
| |
|
JSON functions
Function | Support for Columnstore Indexes |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
Spatial functions
Function | Are columnstore indexes supported? |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|