The In-Memory Column Index (IMCI) feature of PolarDB for MySQL is designed to significantly accelerate your analytical processing (AP) queries. To ensure that your SQL queries are correctly accelerated by IMCI and return the expected results, you must understand the scope and limits of this feature.
General limits
Before you use an In-Memory Column Index (IMCI), make sure your cluster environment and table schema meet the following basic requirements:
Storage engine: You can create an IMCI only for tables that use the
InnoDBstorage engine.Temporary tables: IMCI cannot be used to accelerate queries on temporary tables.
Virtual columns: You can create an IMCI 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 you create the IMCI.
Virtual column types: You cannot create an IMCI on a virtual column of the Spatial type.
Multi-master Cluster (Limitless) Edition: You must first set the cluster parameter
loose_polar_enable_imci_with_mmtoON. Then, you can add a global IMCI read-only node and use the IMCI feature.
SELECT statement limits
IMCI is used only to accelerate SELECT queries. If a query statement contains any of the following structures, the entire query cannot be accelerated by IMCI and falls back to the row store for execution:
SELECTstatements that include locking reads, such asSELECT ... FOR UPDATEorSELECT ... FOR SHARE.SELECTstatements that contain a window function with a frame definition. For example,OVER()is used in theROWS UNBOUNDED PRECEDINGclause.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 an expression of theORDER BYclause. For example,SELECT a FROM t1 ORDER BY (SELECT ... FROM ...) as some_subquery;SELECTstatements where a correlated subquery appears in theONcondition of aJOINclause. 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 a subquery within 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 | Is columnstore index 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 |
| - | |
| Supports BOOLEAN MODE and NATURAL LANGUAGE MODE. | |
| - | |
| When you use the IMCI feature, only one parameter is supported. Two parameters are not supported. |
Encryption and compression expressions
Expression | Is columnstore index supported? |
| |
| |
| |
| |
| |
| |
| |
| |
|
JSON functions
Function | Are columnstore indexes supported? |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
Spatial functions
Function | Can I use a columnstore index? |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|