Limits

Updated at:

PolarDB for MySQL provides the columnstore index (IMCI) feature, which is designed to significantly accelerate analytical processing (AP) queries. To ensure that your SQL queries can be correctly accelerated by columnstore indexes and return expected results, review the supported scope and limits before you use this feature.

General limits

Before you use a columnstore index, make sure that your cluster environment and table schema meet the following basic requirements:

  • Storage engine: You can create columnstore indexes only for tables that use the InnoDB storage engine.

  • Temporary tables: Columnstore indexes cannot be used to accelerate queries on temporary tables.

  • Virtual columns: You can create a columnstore index on a virtual column only when both of the following conditions are met:

    • Set the cluster parameter imci_enable_virtual_column to ON.

      Note

      This parameter is at the SESSION level and cannot be modified in the console.

    • Do not specify order_key when you create the columnstore index.

  • Virtual column types: You cannot create columnstore indexes for virtual columns of the Spatial type.

  • Multi-master cluster (Limitless): Before you can add a global columnstore index read-only node and use the columnstore index feature, first modify the cluster parameter loose_polar_enable_imci_with_mm to ON.

SELECT statement limits

Columnstore indexes are used only to accelerate SELECT queries. If a query statement contains any of the following structures, the entire query cannot be accelerated by a columnstore index and falls back to row store execution:

  • A SELECT statement that contains a locking read, such as SELECT ... FOR UPDATE or SELECT ... FOR SHARE.

  • A SELECT statement that contains a window function with a frame definition. For example, the OVER() clause uses ROWS UNBOUNDED PRECEDING.

    SELECT
        time,
        subject,
        val,
        SUM(val) OVER (
            PARTITION BY subject
            ORDER BY time
            ROWS UNBOUNDED PRECEDING  --- window function frame definition; IMCI does not support it
        ) AS running_total
    FROM
        observations;
  • A subquery appears in the GROUP BY clause of a SELECT statement. For example, SELECT SUM(a) FROM t1 GROUP BY (SELECT ... FROM ...) as some_subquery;

  • A subquery appears in an ORDER BY expression of a SELECT statement. For example, SELECT a FROM t1 ORDER BY (SELECT ... FROM ...) as some_subquery;

  • The correlated item of a subquery appears in the JOIN clause's ON condition of a SELECT statement. For example, WHERE t1.a in (SELECT t2.a FROM t2 INNER JOIN t3 on t2.a = t3.a AND t2.b > t1.b);

  • A subquery contains a window function, and its correlated item appears in the HAVING condition of a SELECT statement.

  • A subquery contains UNION, and its correlated item appears in one of the UNION subqueries of a SELECT statement.

Expression and function limits

If a SELECT statement contains any unsupported expression or function, the entire query falls back to row store execution.

Comparison expressions

Expression

Supported by columnstore indexes

Description

BETWEEN ... AND ...

Supported

If a BETWEEN b AND c uses different data types for b and c, compatibility issues may occur, and query results may differ from results returned without a columnstore index.

NOT BETWEEN ... AND ...

Supported

If a NOT BETWEEN b AND c uses different data types for b and c, compatibility issues may occur, and query results may differ from results returned without a columnstore index.

GREATEST()

Supported

If the input parameters include both the TIME type and a string type, comparison results may differ from results returned without a columnstore index.

IN()

Supported

If IN(expr0, expr1, ...) uses different data types for expr0,expr1,..., compatibility issues may occur, and query results may differ from results returned without a columnstore index.

LEAST()

Supported

If the input parameters include both the TIME type and a string type, comparison results may differ from results returned without a columnstore index.

SOUNDS LIKE

Unsupported

-

String expressions

Expression

Supported by columnstore indexes

Description

SOUNDEX()

Unsupported

-

MATCH

Supported

BOOLEAN MODE and NATURAL LANGUAGE MODE are supported.

LOAD_FILE()

Unsupported

-

TIMESTAMP()

Supported

When you use a columnstore index, only the one-parameter form is supported; the two-parameter form is not supported.

Encryption and compression expressions

Expression

Supported by columnstore indexes

AES_DECRYPT()

Unsupported

AES_ENCRYPT()

Unsupported

COMPRESS()

Unsupported

RANDOM_BYTES()

Unsupported

STATEMENT_DIGEST()

Unsupported

STATEMENT_DIGEST_TEXT()

Unsupported

UNCOMPRESS()

Unsupported

UNCOMPRESSED_LENGTH()

Unsupported

VALIDATE_PASSWORD_STRENGTH()

Unsupported

JSON functions

Function

Supported by columnstore indexes

JSON_ARRAY_INSERT()

Unsupported

JSON_CONTAINS_PATH()

Unsupported

JSON_INSERT()

Unsupported

JSON_MERGE()

Unsupported

JSON_MERGE_PATCH()

Unsupported

JSON_MERGE_PRESERVE()

Unsupported

JSON_REPLACE()

Unsupported

JSON_SCHEMA_VALID()

Unsupported

JSON_SCHEMA_VALIDATION_REPORT()

Unsupported

JSON_SEARCH()

Unsupported

JSON_SET()

Unsupported

JSON_STORAGE_FREE()

Unsupported

JSON_STORAGE_SIZE()

Unsupported

JSON_VALUE()

Unsupported

MEMBER OF()

Unsupported

Spatial functions

Function

Supported by columnstore indexes

ST_AsGeoJSON()

Unsupported

ST_Buffer()

Unsupported

ST_Buffer_Strategy()

Unsupported

ST_Centroid()

Unsupported

ST_Collect()

Unsupported

ST_ConvexHull()

Unsupported

ST_EndPoint()

Unsupported

ST_ExteriorRing()

Unsupported

ST_FrechetDistance()

Unsupported

ST_GeoHash()

Unsupported

ST_GeometryN()

Unsupported

ST_GeometryType()

Unsupported

ST_GeomFromGeoJSON()

Unsupported

ST_HausdorffDistance()

Unsupported

ST_InteriorRingN()

Unsupported

ST_Intersection()

Unsupported

ST_IsClosed()

Unsupported

ST_IsEmpty()

Unsupported

ST_IsSimple()

Unsupported

ST_IsValid()

Unsupported

ST_LatFromGeoHash()

Unsupported

ST_LineInterpolatePoint()

Unsupported

ST_LineInterpolatePoints()

Unsupported

ST_LongFromGeoHash()

Unsupported

ST_NumGeometries()

Unsupported

ST_NumInteriorRing()

Unsupported

ST_NumInteriorRings()

Unsupported

ST_NumPoints()

Unsupported

ST_PointAtDistance()

Unsupported

ST_PointFromGeoHash()

Unsupported

ST_PointN()

Unsupported

ST_StartPoint()

Unsupported

ST_SwapXY()

Unsupported