All Products
Search
Document Center

PolarDB:IMCI-related operators

Last Updated:Mar 28, 2026

When you run EXPLAIN on a query that uses the In-Memory Column Index (IMCI), the output shows an execution plan made up of IMCI-specific operators. This reference covers every operator you may see, what it does, and the fields available in its Extra Info column.

To analyze query performance using the execution plan, see Analyze the IMCI-based query performance.

EXPLAIN output columns

ColumnDescription
IDRow sequence number.
OperatorName of the operator in the execution plan.
NameName of the scanned table. Displayed only for the Table Scan operator.
E-RowsEstimated number of rows returned by the operator. Calculated by the optimizer.
E-CostsEstimated cost to run the operator. Calculated by the optimizer. This is an accumulated value — the cost of each operator includes the costs of all its child nodes.
Extra InfoAdditional operator-specific details that provide further information about the execution plan.

How to read an execution plan

EXPLAIN displays the execution plan as a tree. Each row is a node with a parent node and child nodes. Child nodes run before parent nodes. When multiple nodes are at the same depth, the node with the lowest ID runs first.

Example execution plan:

+----+----------------------+------+--------+--------+---------------------------------------------------------------+
| ID | Operator             | Name | E-Rows | E-Cost | Extra Info                                                    |
+----+----------------------+------+--------+--------+---------------------------------------------------------------+
|  1 | Select Statement     |      |        |        | IMCI Execution Plan (max_dop = 32, max_query_mem = unlimited) |
|  2 | └─Hash Groupby       |      | 30     | 0.25   | Group Key: t1.a                                               |
|  3 |   └─Hash Join        |      | 30     | 0.15   | Join Cond: t1.a = t2.a                                        |
|  4 |     ├─Table Scan     | t1   | 30     | 0.00   |                                                               |
|  5 |     └─Table Scan     | t2   | 30     | 0.00   |                                                               |
+----+----------------------+------+--------+--------+---------------------------------------------------------------+

The execution order for this plan:

  1. ID 4: Scan all rows in t1 and build the hash table.

  2. ID 5: Scan all rows in t2.

  3. ID 3: Perform a hash join by probing the hash table built from t1 against the data from t2.

  4. ID 2: Group the hash join results using Hash Groupby and return the final result.

Operators

Operators are grouped by function:

Scan operators

Scan operators read rows from a data source and optionally filter them before passing the result to the next operator.

Table Scan

Scans all rows of a table and filters rows using predicates, if any.

Extra Info fields:

FieldDescription
CondThe predicate used to filter rows during the scan.
PartitionsThe partitions scanned. Displayed only when a subset of partitions is scanned on a partitioned table.
DynamicFilterThe dynamic filter built and pushed down by the Hash Build side of a Hash Join.

Constant Scan

Scans all rows in a constant table and returns the results. A constant table is generated in the following situations:

  • A long IN-list such as col IN (1, 2, ..., 100) is converted into a semi join. A constant table with the corresponding rows is generated to accelerate the predicate.

  • A SQL statement contains constants, such as SELECT 1;. The optimizer generates a one-row constant table to drive the query.

  • A subquery is determined unlikely to return results during optimization. The subquery is replaced with an empty constant table to skip unnecessary processing.

Extra Info fields:

FieldDescription
Empty TableThe constant table is empty.
Cte TableThe constant table caches the results of a recursive common table expression (CTE).

HybridIndexSearch

Uses the primary key to look up row indexes, accelerating detailed queries on wide tables. For more information, see Use hybrid plans to accelerate wide table queries.

Extra Info fields:

FieldDescription
Used tableThe table being queried.

Join operators

Join operators combine rows from two or more tables. IMCI supports three join algorithms. The optimizer selects the algorithm based on data volume, join conditions, and whether equality conditions are available.

OperatorWhen the optimizer uses it
Hash JoinEquality condition available; large data volumes
Nested Loop JoinNo equality condition, or when Hash Join prerequisites are not met
Cartesian ProductInner join with no predicates
Group JoinQuery has both a JOIN and a GROUP BY on the same column

All join operators support left and right outer joins and left and right semi-joins. The join type is reflected in the operator name, such as Hash Left Semi Join.

Hash Join

Reads data from the build side first, builds a hash table using the equality condition columns, then reads data from the probe side and finds matching rows in the hash table.

Hash Join supports two execution modes:

  • Blocking mode: All results from the current operator are written to a temporary table first. Downstream operators consume data from the temporary table. Fewer concurrent operators means each operator has more memory available when memory is constrained.

  • Pipeline mode: Downstream operators pull data directly from the current operator with no temporary table overhead. Provides better performance when memory is sufficient.

Extra Info fields:

FieldDescription
IsBlockingWhether blocking mode is used.
Join CondThe equality predicate used for the join.
PostJoin FilterA non-equality predicate applied after the join. For example, in t1 LEFT JOIN t2 ON t1.c1 = t2.c1 AND t1.c2 > t2.c2, the t1.c2 > t2.c2 expression is a PostJoin filter.
SemiProbeA semi-join variant where the probe side returns each row paired with a boolean flag indicating whether a match was found, instead of filtering non-matching rows. For example, for t1 LEFT SEMI JOIN(SEMIPROBE) t2 ON t1.a = t2.a where t1: (a: 1) and t2: (a: 2), a standard semi-join returns no result, but SemiProbe returns (1, False). SemiProbe occurs primarily in complex subqueries.
DynamicFilterThe dynamic filter built and pushed down by the Hash Build side.

Nested Loop Join or Cartesian Product

Nested Loop Join traverses the driving table and, for each row, scans the entire driven table to find matching rows. It is generally less efficient than Hash Join and is used when Hash Join prerequisites are not met, such as when no equality condition is available.

Cartesian Product is a special case of Nested Loop Join: an inner join with no predicates, meaning all row combinations satisfy the join condition.

Extra Info fields:

FieldDescription
Join CondThe predicate used for the join.
SemiProbeA semi-join variant. See the SemiProbe description under Hash Join.

Group Join

Optimizes queries that have both a JOIN and a GROUP BY on the same column. When the group column also appears in the JOIN condition, Group Join reuses the same hash table for both operations, reducing overhead.

For example, in the following query, both JOIN and GROUP BY use t1.a:

SELECT t1.a, COUNT(*) FROM t1 JOIN t2 ON t1.a = t2.a GROUP BY t1.a

Without Group Join, the execution plan uses separate Hash Join and Hash Groupby operators:

+----+----------------------+------+------------------------+
| ID | Operator             | Name | Extra Info             |
+----+----------------------+------+------------------------+
|  1 | Select Statement     |      |                        |
|  2 | └─Hash Groupby       |      | Group Key: t1.a        |
|  3 |   └─Hash Join        |      | Join Cond: t2.a = t1.a |
|  4 |     ├─Table Scan     | t2   |                        |
|  5 |     └─Table Scan     | t1   |                        |
+----+----------------------+------+------------------------+

With Group Join, a single operator handles both:

+----+--------------------+------+-----------------------------------------+
| ID | Operator           | Name | Extra Info                              |
+----+--------------------+------+-----------------------------------------+
|  1 | Select Statement   |      |                                         |
|  2 | └─Group Join       |      | Join Cond: t2.a = t1.a, Group Key: t1.a |
|  3 |   ├─Table Scan     | t2   |                                         |
|  4 |   └─Table Scan     | t1   |                                         |
+----+--------------------+------+-----------------------------------------+

Extra Info fields:

FieldDescription
Join CondThe predicate used for the join.
Group KeyThe group column, which is a unique key and is marked with unique.

Aggregation and grouping operators

Hash Groupby or Aggregation

Hash Groupby runs the GROUP BY clause. It uses a hash table to group rows by one or more columns and applies an aggregate function (such as SUM, COUNT, AVG, MAX, or MIN) to each group.

Aggregation is a special case of Hash Groupby with no group columns.

Extra Info fields:

FieldDescription
Group KeyThe column or columns used for grouping.

Union or Union All

Combines the results of multiple queries.

Union deduplicates the combined results. Union All returns all rows without deduplication. In IMCI, Union is typically implemented using Union All together with Hash Groupby, so Union rarely appears in execution plans directly.

Window

Performs aggregation or other complex operations over a window frame — the current row and its surrounding context — while keeping the original dataset unchanged.

Note

Some simple window functions may be executed using GROUP BY and JOIN operators instead of the Window operator.

Extra Info fields:

FieldDescription
Partition KeyThe partition key column. Equivalent to the PARTITION BY clause. If absent, the entire dataset is treated as one partition.
Sort KeyThe sort key within the partition. Equivalent to the ORDER BY clause in a window function.
FrameThe scope of the window.

Expand

Works with Hash Groupby to implement the WITH ROLLUP clause. For each input row, Expand generates multiple rows — one for each level of the rollup hierarchy.

For example, given the query:

SELECT SUM(a) FROM t1 GROUP BY b, c WITH ROLLUP;

For the row (a, b, c) = (1, 2, 3), Expand generates:

Expand(1, 2, 3) = [(1, 2, 3), (1, 2, NULL), (1, NULL, NULL)]

Each generated row nulls out progressively more group key columns to produce the hierarchical aggregation.

Extra Info fields:

FieldDescription
Expand ExprsThe group key columns, matching the Group Key field in Hash Groupby. If there are k Expand Exprs, the operator generates k+1 rows for each original row.

Utility operators

Filter or Assert

Filter evaluates a predicate on each row and passes only the rows that satisfy the condition.

Assert is a variant of Filter. If a row fails the predicate, Assert returns an error instead of discarding the row. Asserts are typically introduced during subquery unnesting.

Extra Info fields:

FieldDescription
CondThe predicate used by the filter or assert.

Sort

Sorts the input rows.

Extra Info fields:

FieldDescription
Sort KeyThe sort key columns and their order. Format: column_name ASC|DESC, for example, t1.col ASC, t2.col DESC.

Limit

Returns only the specified number of rows from the input.

Extra Info fields:

FieldDescription
LimitThe maximum number of rows to return.
OffsetThe number of rows to skip before returning results.

Max1Row

An assert that ensures a scalar subquery returns at most one row. If the subquery returns more than one row, it throws the error: Subquery returns more than 1 row.

Create Unique Key

Creates a non-empty unique integer key for a subquery result set. Typically generated during subquery unnesting.

Compute Scalar

Accepts input rows and returns rows with additional scalar values computed from an expression.

Table Spool

Caches and reuses data during query execution. Table Spool has two types:

  • Primary Table Spool: Accepts input and writes it to a temporary table inside the database.

  • Ref Table Spool: Reads data from the temporary table created by the corresponding Primary Table Spool.

Example — the query EXPLAIN SELECT SUM(DISTINCT a), SUM(DISTINCT b) FROM t1 produces:

+----+-----------------------------------+------+-----------------+
| ID | Operator                          | Name | Extra Info      |
+----+-----------------------------------+------+-----------------+
|  1 | Select Statement                  |      |                 |
|  2 | └─Cartesian Product               |      |                 |
|  3 |   ├─Aggregation                   |      |                 |
|  4 |   │ └─Hash Groupby                |      | Group Key: t1.a |
|  5 |   │   └─Primary Table Spool       |      |                 |
|  6 |   │     └─Table Scan              | t1   |                 |
|  7 |   └─Aggregation                   |      |                 |
|  8 |     └─Hash Groupby                |      | Group Key: t1.b |
|  9 |       └─Ref Table Spool           |      | Ref: 5          |
+----+-----------------------------------+------+-----------------+

The Ref Table Spool at ID 9 reads from the temporary table written by the Primary Table Spool at ID 5.

image

Extra Info fields:

FieldDescription
RefThe ID of the Primary Table Spool operator this Ref Table Spool reads from.

RecursiveCte

Executes recursive queries. The result set is built by iterating until a termination condition is met. RecursiveCte has two parts:

  • Base Case (Anchor Member): The starting point. Returns the initial set of rows without referencing the CTE itself.

  • Recursive Member: References the CTE by name to expand the result set. Each iteration uses the results of the previous one until the termination condition is met.

Example structure:

WITH Recursive_CTE AS (
    -- Base Case: result recorded as {A}
    SELECT column_list
    FROM table_name
    WHERE condition_for_base_case

    UNION ALL

    -- Recursive Member: result recorded as {B1}, {B2}, ..., {Bi}
    SELECT column_list
    FROM table_name
    JOIN Recursive_CTE ON join_condition
    WHERE condition_to_continue_recursive
)
SELECT * FROM Recursive_CTE;

Each time Recursive Member runs, it references the result of the previous iteration:

  • First iteration: references image.svg, produces image.svg

  • Second iteration: references image.svg, produces image.svg

  • kth iteration: references image.svg, produces image.svg

The recursion terminates when the result image.svg is empty.

In execution plans containing RecursiveCte, a Cte Table entry in Constant Scan indicates that a constant table caches the referenced CTE results.

Extra Info fields:

FieldDescription
Left ExprsThe columns returned by the Base Case (Anchor Member).
Right ExprsThe columns returned by the Recursive Member.

JsonTable

Converts JSON data into a relational table so it can be queried with standard SQL. For the full function reference, see the MySQL documentation.

Extra Info fields:

FieldDescription
JsonExprThe JSON expression. Can be a table column, a constant string, or the result of an expression, such as (JSON_EXTRACT(t1.json_data,'$.post.comments')).
PathExprThe path within the JSON from which to extract data.
ChildExprsAll columns defined in the JSON table, plus all columns in the operator's output.

Parallel distribution operators

Exchange and Consumer redistribute data across nodes. These operators appear only in multi-node elastic parallel query execution plans.

Exchange accepts inputs from multiple nodes and distributes them according to one of three rules:

Distribution ruleBehavior
BroadcastData is sent to all nodes. Each node holds a complete copy.
HashRows are hashed and routed to partitions based on hash values.
GatherInputs from multiple nodes are merged into a single node.

Extra Info fields:

FieldDescription
PipeIdThe ID of the current pipeline. The distributed plan is divided into multiple pipelines.
Producers&ConsumersThe transmitter and receiver IDs for the data redistribution.
Part TypeThe distribution rule (Broadcast, Hash, or Gather).
Partition KeyThe partition key columns used when data is redistributed.

What's next