> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Profile Metrics

> Reference for all raw metrics emitted by the database Query Profile, organized by operator type.

> Authoritative reference for raw metrics emitted by **the database Query Profile**, grouped by operator.\
> Use it as a glossary; for troubleshooting guidance jump to **query\_profile\_tuning\_recipes.md**.

### Summary Metrics

Basic information about the query execution:

| Metric | Description |
| - | - |
| Total | The total time consumed by the query, including Planning, Executing, and Profiling phase durations. |
| Query State | Query state, possible states include Finished, Error, and Running. |
| Query ID | Unique identifier for the query. |
| Start Time | Timestamp when the query started. |
| End Time | Timestamp when the query ended. |
| Total | Total duration of the query. |
| Query Type | Type of the query. |
| Query State | Current state of the query. |
| Version | Version of the database used. |
| User | User who executed the query. |
| Default Db | Default database used for the query. |
| Sql Statement | SQL statement executed. |
| Variables | Important variables used for the query. |
| NonDefaultSessionVariables | Non-default session variables used for the query. |
| Collect Profile Time | Time taken to collect the profile. |
| IsProfileAsync | Indicates if the profile collection was asynchronous. |

### Planner Metrics

It provides a comprehensive overview of the planner. Typically, if the total time spent on the planner is less than 10ms, it is not a cause for concern.

In certain scenarios, the planner may require more time:

1. Complex queries may necessitate additional time for parsing and optimization to ensure an optimal execution plan.
2. The presence of numerous materialized views can increase the time required for query rewriting.
3. When multiple concurrent queries exhaust system resources and the query queue is utilized, the `Pending` time may be prolonged.
4. Queries involving external tables may incur additional time for communication with the external metadata server.

Example:

```
     - -- Parser[1] 0
     - -- Total[1] 3ms
     -     -- Analyzer[1] 0
     -         -- Lock[1] 0
     -         -- AnalyzeDatabase[1] 0
     -         -- AnalyzeTemporaryTable[1] 0
     -         -- AnalyzeTable[1] 0
     -     -- Transformer[1] 0
     -     -- Optimizer[1] 1ms
     -         -- MVPreprocess[1] 0
     -         -- MVTextRewrite[1] 0
     -         -- RuleBaseOptimize[1] 0
     -         -- CostBaseOptimize[1] 0
     -         -- PhysicalRewrite[1] 0
     -         -- DynamicRewrite[1] 0
     -         -- PlanValidate[1] 0
     -             -- InputDependenciesChecker[1] 0
     -             -- TypeChecker[1] 0
     -             -- CTEUniqueChecker[1] 0
     -             -- ColumnReuseChecker[1] 0
     -     -- ExecPlanBuild[1] 0
     - -- Pending[1] 0
     - -- Prepare[1] 0
     - -- Deploy[1] 2ms
     -     -- DeployLockInternalTime[1] 2ms
     -         -- DeploySerializeConcurrencyTime[2] 0
     -         -- DeployStageByStageTime[6] 0
     -         -- DeployWaitTime[6] 1ms
     -             -- DeployAsyncSendTime[2] 0
     - DeployDataSize: 10916
    Reason:
```

### Execution Overview Metrics

High-level execution statistics:

| Metric | Description | Rule of Thumb |
| - | - | - |
| FrontendProfileMergeTime | FE-side profile processing time | \< 10ms normal |
| QueryAllocatedMemoryUsage | Total allocated memory across nodes | |
| QueryDeallocatedMemoryUsage | Total deallocated memory across nodes | |
| QueryPeakMemoryUsagePerNode | Maximum peak memory per node | \< 80% capacity normal |
| QuerySumMemoryUsage | Total peak memory across nodes | |
| QueryExecutionWallTime | Wall time of execution | |
| QueryCumulativeCpuTime | Total CPU time across nodes | Compare with `walltime * totalCpuCores` |
| QueryCumulativeOperatorTime | Total operator execution time | Denominator for operator time percentages |
| QueryCumulativeNetworkTime | Total Exchange node network time | |
| QueryCumulativeScanTime | Total Scan node IO time | |
| QueryPeakScheduleTime | Maximum Pipeline ScheduleTime | \< 1s normal for simple queries |
| QuerySpillBytes | Data spilled to disk | \< 1GB normal |

### Per-Table Scan Stats

A `PerTableScanStats` summary is attached to the merged query profile, breaking down scan
work by table and by backend host. It is built by walking the per-instance profile tree
before the isomorphic merge collapses host-level information, aggregating the `RowsRead`,
`BytesRead`, and `RawRowsRead` counters that scan operators publish on `UniqueMetrics`
together with the `Database` and `Table` info strings. The key is qualified with the
database name so that same-named tables in different databases (for example `db1.orders`
vs `db2.orders`) are kept in separate buckets. If the BE does not report a database for a
given scan, the bare table name is used as a fallback. Useful for spotting data skew
across BE nodes and identifying which tables dominate a query's scan cost.

Structure:

```
PerTableScanStats
  TableNum / ScanRows / ScanBytes / RawScanRows   -- query-wide totals
  Table: <database>.<table>                       -- bare <table> if database absent
    HostNum / ScanRows / ScanBytes / RawScanRows  -- per-table totals
    Host: <host:port>
      ScanRows / ScanBytes / RawScanRows          -- per (table, host)
```

| Metric | Description |
| - | - |
| TableNum | Number of distinct tables scanned (top-level only) |
| HostNum | Number of BE hosts that scanned this table (table-level only) |
| ScanRows | Filtered rows read, aggregated by scope |
| ScanBytes | Bytes read after filtering, aggregated by scope (not reported by every connector) |
| RawScanRows | Raw rows read before predicate filtering, aggregated by scope |

### Fragment Metrics

Fragment-level execution details:

| Metric | Description |
| - | - |
| InstanceNum | Number of FragmentInstances |
| InstanceIds | IDs of all FragmentInstances |
| BackendNum | Number of participating BEs |
| BackendAddresses | BE addresses |
| FragmentInstancePrepareTime | Fragment Prepare phase duration |
| InstanceAllocatedMemoryUsage | Total allocated memory for instances |
| InstanceDeallocatedMemoryUsage | Total deallocated memory for instances |
| InstancePeakMemoryUsage | Peak memory across instances |

### Pipeline Metrics

Pipeline execution details and relationships:

![profile\_pipeline\_time\_relationship](https://mintcdn.com/mirrorship-docs/sL46GVQByWEibCzI/documents/images/73f5626ba777ddf086f572b4.jpeg?fit=max\&auto=format\&n=sL46GVQByWEibCzI\&q=85\&s=193bd0adf12c17224eea02d8fc8c6393)

Key relationships:

* DriverTotalTime = ActiveTime + PendingTime + ScheduleTime
* ActiveTime = ∑ OperatorTotalTime + OverheadTime
* PendingTime = InputEmptyTime + OutputFullTime + PreconditionBlockTime + PendingFinishTime
* InputEmptyTime = FirstInputEmptyTime + FollowupInputEmptyTime

| Metric | Description |
| - | - |
| DegreeOfParallelism | Degree of pipeline execution parallelism. |
| TotalDegreeOfParallelism | Sum of degrees of parallelism. Since the same Pipeline may execute on multiple machines, this item aggregates all values. |
| DriverPrepareTime | Time taken by the Prepare phase. This metric is not included in DriverTotalTime. |
| DriverTotalTime | Total execution time of the Pipeline, excluding the time spent in the Prepare phase. |
| ActiveTime | Execution time of the Pipeline, including the execution time of each operator and the overall framework overhead, such as time spent in invoking methods like has\_output, need\_input, etc. |
| PendingTime | Time the Pipeline is blocked from being scheduled for various reasons. |
| InputEmptyTime | Time the Pipeline is blocked due to an empty input queue. |
| FirstInputEmptyTime | Time the Pipeline is first blocked due to an empty input queue. The first blocking time is separately calculated because the first blocking is mainly caused by Pipeline dependencies. |
| FollowupInputEmptyTime | Time the Pipeline is subsequently blocked due to an empty input queue. |
| OutputFullTime | Time the Pipeline is blocked due to a full output queue. |
| PreconditionBlockTime | Time the Pipeline is blocked due to unmet dependencies. |
| PendingFinishTime | Time the Pipeline is blocked waiting for asynchronous tasks to finish. |
| ScheduleTime | Scheduling time of the Pipeline, from entering the ready queue to being scheduled for execution. |
| BlockByInputEmpty | Number of times the pipeline is blocked due to InputEmpty. |
| BlockByOutputFull | Number of times the pipeline is blocked due to OutputFull. |
| BlockByPrecondition | Number of times the pipeline is blocked due to unmet preconditions. |

### Operator Metrics

| Metric | Description |
| - | - |
| PrepareTime | Time spent on preparation. |
| OperatorTotalTime | Total time consumed by the Operator. It satisfies the equation: OperatorTotalTime = PullTotalTime + PushTotalTime + SetFinishingTime + SetFinishedTime + CloseTime. It excludes time spent on preparation. |
| PullTotalTime | Total time the Operator spends executing push\_chunk. |
| PushTotalTime | Total time the Operator spends executing pull\_chunk. |
| SetFinishingTime | Total time the Operator spends executing set\_finishing. |
| SetFinishedTime | Total time the Operator spends executing set\_finished. |
| PushRowNum | Cumulative number of input rows for the Operator. |
| PullRowNum | Cumulative number of output rows for the Operator. |
| JoinRuntimeFilterEvaluate | Number of times Join Runtime Filter is evaluated. |
| JoinRuntimeFilterHashTime | Time spent computing hash for Join Runtime Filter. |
| JoinRuntimeFilterInputRows | Number of input rows for Join Runtime Filter. |
| JoinRuntimeFilterOutputRows | Number of output rows for Join Runtime Filter. |
| JoinRuntimeFilterTime | Time spent on Join Runtime Filter. |

### Scan Operator

#### OLAP Scan Operator

The OLAP\_SCAN Operator is responsible for reading data from native tables.

| Metric | Description |
| - | - |
| Table | Table name. |
| VectorIndexIOLocalDiskBytes | Bytes from completed local file reads during vector index loading in shared-nothing Pipeline scans. Includes OS page-cache hits but excludes partial bytes from failed calls; does not measure physical disk traffic. |
| VectorIndexIOLocalDiskTime | Time spent in local read calls, including failed calls and excluding index array allocation and deserialization. Does not include later IVF list reads during search. |
| VectorIndexParallelLoads | Number of index load attempts assigned parallel mode, including eligible shared-nothing HNSW loads. Cache hits do not increment this counter. The selected mode does not guarantee concurrent I/O: small reads or unavailable helper capacity may leave the calling thread to perform the reads alone. |
| VectorIndexStreamedLoads | Number of index load attempts assigned streamed mode. Cache hits do not increment this counter. A later load failure does not undo the increment. |
| Rollup | Materialized view name. If no materialized view is hit, it is equivalent to the table name. |
| SharedScan | Whether the enable\_shared\_scan session variable is enabled. |
| TabletCount | Number of tablets. |
| MorselsCount | Number of morsels, which is the basic IO execution unit. |
| PushdownPredicates | Number of pushdown predicates. |
| Predicates | Predicate expressions. |
| BytesRead | Size of data read. |
| CompressedBytesRead | Size of compressed data read from disk. |
| UncompressedBytesRead | Size of uncompressed data read from disk. |
| RowsRead | Number of rows read (after predicate filtering). |
| RawRowsRead | Number of raw rows read (before predicate filtering). |
| ReadPagesNum | Number of pages read. |
| CachedPagesNum | Number of cached pages. |
| ChunkBufferCapacity | Capacity of the Chunk Buffer. |
| DefaultChunkBufferCapacity | Default capacity of the Chunk Buffer. |
| PeakChunkBufferMemoryUsage | Peak memory usage of the Chunk Buffer. |
| PeakChunkBufferSize | Peak size of the Chunk Buffer. |
| PrepareChunkSourceTime | Time spent preparing the Chunk Source. |
| ScanTime | Cumulative scan time. Scan operations are completed in an asynchronous I/O thread pool. |
| IOTaskExecTime | Execution time of IO tasks. |
| IOTaskWaitTime | Waiting time from successful submission to scheduled execution of IO tasks. |
| SubmitTaskCount | Number of times IO tasks are submitted. |
| SubmitTaskTime | Time spent on task submission. |
| PeakIOTasks | Peak number of IO tasks. |
| PeakScanTaskQueueSize | Peak size of the IO task queue. |

##### Shared-data vector index loading

Shared-data scans also expose `VectorIndexIOLocalDiskBytes`, `VectorIndexIOLocalDiskTime`, `VectorIndexParallelLoads`, and `VectorIndexStreamedLoads`. Local I/O values come from the underlying file system's local-disk statistics; load-mode counters follow the counting rules described above.

When a shared-data scan prepares a seed iterator to refine physical scan splits, vector index loading in that phase is recorded under `SeedVectorIndex*` within `SeedPrepareTime`, separately from the ordinary scan-phase counters. The I/O metrics below cover initial index loading, excluding array allocation, deserialization, and later IVF list reads during search. Local and remote I/O times are summed across streams, so parallel reads can exceed the elapsed time reported by `VectorIndexFileRead` or `SeedVectorIndexFileRead`.

| Metric | Description |
| - | - |
| VectorIndexIORemoteBytes | Bytes read from remote storage during vector index loading, as reported by the underlying file system. |
| VectorIndexIORemoteTime | Cumulative remote-read time during vector index loading, as reported by the underlying file system. |
| SeedVectorIndexIOLocalDiskBytes | Local-disk bytes read during vector index loading in seed preparation, as reported by the underlying file system. |
| SeedVectorIndexIORemoteBytes | Remote-storage bytes read during vector index loading in seed preparation, as reported by the underlying file system. |
| SeedVectorIndexIOLocalDiskTime | Cumulative local-disk read time during vector index loading in seed preparation. |
| SeedVectorIndexIORemoteTime | Cumulative remote-read time during vector index loading in seed preparation. |
| SeedVectorIndexParallelLoads | Load attempts assigned parallel mode during seed preparation, with the same counting rules as `VectorIndexParallelLoads`. |
| SeedVectorIndexStreamedLoads | Load attempts assigned streamed mode during seed preparation, with the same counting rules as `VectorIndexStreamedLoads`. |

#### Connector Scan Operator

It's similar to OLAP\_SCAN operator but used for scan external tables like Iceberg/Hive/Hudi/Detal.

| Metric | Description |
| - | - |
| DataSourceType | Data source type, can be HiveDataSource, ESDataSource, and so on. |
| Table | Table name. |
| TabletCount | Number of tablets. |
| MorselsCount | Number of morsels, including root clip tasks and generated I/O children for grouped lake scans. |
| RangeClipTasks | Number of grouped lake root range-clip tasks successfully opened, reported under `DataSource`. Counted once per validated root, including roots that return no rows or only publish physical rowid children. Children, segment reads and reader reopens do not add to this count. |
| Predicates | Predicate expression. |
| PredicatesPartition | Predicate expression applied to partitions. |
| SharedScan | Whether the `enable_shared_scan` Session variable is enabled. |
| ChunkBufferCapacity | Capacity of the Chunk Buffer. |
| DefaultChunkBufferCapacity | Default capacity of the Chunk Buffer. |
| PeakChunkBufferMemoryUsage | Peak memory usage of the Chunk Buffer. |
| PeakChunkBufferSize | Peak size of the Chunk Buffer. |
| PrepareChunkSourceTime | Time taken to prepare the Chunk Source. |
| ScanTime | Cumulative time for scanning. Scan operation is completed in the asynchronous I/O thread pool. |
| IOTaskExecTime | Execution time of I/O tasks. |
| IOTaskWaitTime | Waiting time from successful submission to scheduled execution of IO tasks. |
| SubmitTaskCount | Number of times IO tasks are submitted. |
| SubmitTaskTime | Time taken to submit tasks. |
| PeakIOTasks | Peak number of IO tasks. |
| PeakScanTaskQueueSize | Peak size of the IO task queue. |
| RuntimeFilterEvalTime | Time spent evaluating join runtime filters against decoded rows inside the Parquet reader. |
| RuntimeFilterInputRows | Number of rows fed into the Parquet reader's join runtime filter evaluation. |
| RuntimeFilterOutputRows | Number of rows surviving the Parquet reader's join runtime filter evaluation. A large gap from `RuntimeFilterInputRows` means the filter dropped rows before lazy columns were materialized. |
| ScanRangesPrunedByPartitionValue | Number of scan ranges skipped before they are read because a predicate or an arrived join runtime filter rejects their identity partition values. |
| ScanRangesPrunedByFileStats | Number of scan ranges skipped before their data file is opened because the file-level min/max values from the Iceberg manifest show that no row can satisfy a predicate or an arrived runtime filter (join or Top-N). Parquet and ORC files only. |
| PaimonFSAppIOCount | Number of valid read attempts received by the Paimon file-system adapter. It is the sum of sequential, positional, and asynchronous reads. |
| PaimonFSAppIOBytes | Bytes returned successfully by reads at the Paimon file-system adapter boundary. |
| PaimonFSAppIOTime | End-to-end time of reads at the Paimon file-system adapter boundary. |
| PaimonFSIOCount | Number of backing file-system reads below Data Cache and Shared Buffered Input Stream. This is a database file-system call count, not necessarily the number of remote object-store RPCs. |
| PaimonFSIOBytes | Bytes returned successfully by backing file-system reads for a Paimon native scan. |
| PaimonFSIOTime | Time spent in backing file-system reads for a Paimon native scan. |
| PaimonFSSequentialReadCount | Number of sequential Paimon file-system adapter read attempts. |
| PaimonFSSequentialReadBytes | Bytes returned successfully by sequential Paimon file-system adapter reads. |
| PaimonFSSequentialReadTime | Time spent in sequential Paimon file-system adapter reads. |
| PaimonFSPositionalReadCount | Number of positional Paimon file-system adapter read attempts. |
| PaimonFSPositionalReadBytes | Bytes returned successfully by positional Paimon file-system adapter reads. |
| PaimonFSPositionalReadTime | Time spent in positional Paimon file-system adapter reads. |
| PaimonFSAsyncReadCount | Number of asynchronous Paimon file-system adapter read attempts. |
| PaimonFSAsyncReadBytes | Bytes returned successfully by asynchronous Paimon file-system adapter reads. |
| PaimonFSAsyncReadTime | Time spent in asynchronous Paimon file-system adapter reads. |

### Exchange Operator

Exchange Operator is responsible for transmitting data between BE nodes. There can be several kinds of exchange operations: GATHER/BROADCAST/SHUFFLE.

Typical scenarios that can make Exchange Operator the bottleneck of a query:

1. Broadcast Join: This is a suitable method for a small table. However, in exceptional cases when the optimizer chooses a suboptimal query plan, it can lead to a significant increase in network bandwidth.
2. Shuffle Aggregation/Join: Shuffling a large table can result in a significant increase in network bandwidth.

#### Exchange Sink Operator

| Metric | Description |
| - | - |
| ChannelNum | Number of channels. Generally, the number of channels is equal to the number of receivers. |
| DestFragments | List of destination FragmentInstance IDs. |
| DestID | Destination node ID. |
| PartType | Data distribution mode, including: UNPARTITIONED, RANDOM, HASH\_PARTITIONED, and BUCKET\_SHUFFLE\_HASH\_PARTITIONED. |
| SerializeChunkTime | Time taken to serialize chunks. |
| SerializedBytes | Size of serialized data. |
| ShuffleChunkAppendCounter | Number of Chunk Append operations when PartType is HASH\_PARTITIONED or BUCKET\_SHUFFLE\_HASH\_PARTITIONED. |
| ShuffleChunkAppendTime | Time taken for Chunk Append operations when PartType is HASH\_PARTITIONED or BUCKET\_SHUFFLE\_HASH\_PARTITIONED. |
| ShuffleHashTime | Time taken to calculate hash when PartType is HASH\_PARTITIONED or BUCKET\_SHUFFLE\_HASH\_PARTITIONED. |
| RequestSent | Number of data packets sent. |
| RequestUnsent | Number of unsent data packets. This metric is non-zero when there is a short-circuit logic; otherwise, it is zero. |
| BytesSent | Size of sent data. |
| BytesUnsent | Size of unsent data. This metric is non-zero when there is a short-circuit logic; otherwise, it is zero. |
| BytesPassThrough | If the destination node is the current node, data will not be transmitted over the network, which is called passthrough data. This metric indicates the size of such passthrough data. Passthrough is controlled by `enable_exchange_pass_through`. |
| PassThroughBufferPeakMemoryUsage | Peak memory usage of the PassThrough Buffer. |
| ShuffleChunkBufferNum | Number of partial chunks the sink allocated to buffer rows per destination pipeline driver when PartType is HASH\_PARTITIONED or BUCKET\_SHUFFLE\_HASH\_PARTITIONED. It grows beyond the number of destination drivers when partial chunks are released and allocated again. |
| ShuffleChunkBufferPeakMemoryUsage | Peak memory retained by these partial chunks. A partial chunk is only sent once it is full, so with many destinations, a high DOP, and wide rows this can approach the whole input of the sink. It is bounded by the BE configuration `exchange_sink_buffer_flush_threshold_bytes`. |
| ShuffleBufferFlushCount | Number of times the partial chunks exceeded `exchange_sink_buffer_flush_threshold_bytes` and were sent before they were full. |
| ShuffleBufferFlushRows | Number of rows sent by these early flushes. |
| ShuffleBufferReleasedChunks | Number of partial chunks released after an early flush because the memory they still held exceeded half of `exchange_sink_buffer_flush_threshold_bytes`. |
| PeakSerializedChunkBytes | Size of the largest serialized chunk before compression. |
| PeakRequestBytes | Size of the largest request sent over the network, after compression if it applies. `BytesSent / RequestSent` gives the average request size. Passthrough data is not counted. |
| SinkBufferPeakMemoryUsage | Peak memory of the requests waiting to be sent or in flight in the sink buffer. |
| SinkBufferMemoryLimit | Memory limit of the sink buffer. By default, it is `sink_buffer_mem_limit_per_driver` multiplied by the number of destinations. When it is reached, the sink stops accepting data until requests complete. |
| SinkBufferPeakInFlightRpcNum | Peak number of RPCs in flight at the same time. |
| SinkBufferPeakRequestNum | Peak number of requests waiting to be sent or in flight in the sink buffer. |
| CompressTime | Compression time. |
| CompressedInputBytes | Size of the serialized (pre-compression) data that was actually fed to the compressor. Chunks skipped by the adaptive compression strategy are not counted. `CompressedInputBytes / CompressedBytes` gives the compression ratio, and `SerializedBytes - CompressedInputBytes` is the size of data that was not compressed. |
| CompressedBytes | Size of compressed data. Only chunks that were actually compressed are counted. |
| OverallThroughput | Throughput rate. |
| NetworkTime | Time taken for data packet transmission (excluding post-reception processing time). |
| NetworkBandwidth | Estimated network bandwidth. |
| WaitTime | Sum of `BufferFullTime` and `PendingFinishTime`. |
| BufferFullTime | Accumulated recorded time that the sender buffer was full. A child of `WaitTime`. |
| PendingFinishTime | Elapsed time since the sink buffer began finishing, measured when the profile is updated; zero before finishing begins. A child of `WaitTime`, separate from the Pipeline-level counter of the same name. |
| OverallTime | Total time for the entire transmission process, i.e., from sending the first data packet to confirming the correct reception of the last data packet. |
| RpcAvgTime | Average time for RPC. |
| RpcCount | Total number of RPCs. |

#### Exchange Source Operator

| Metric | Description |
| - | - |
| RequestReceived | Size of received data packets. |
| BytesReceived | Size of received data. |
| DecompressChunkTime | Time taken to decompress chunks. |
| DeserializeChunkTime | Time taken to deserialize chunks. |
| ClosureBlockCount | Number of blocked Closures. |
| ClosureBlockTime | Blocked time for Closures. |
| ReceiverProcessTotalTime | Total time taken for receiver-side processing. |
| WaitLockTime | Lock waiting time. |

### Aggregate Operator

**Metrics List**

| Metric | Description |
| - | - |
| `GroupingKeys` | `GROUP BY` columns. |
| `AggregateFunctions` | Time taken for aggregate function calculations. |
| `AggComputeTime` | Time for AggregateFunctions + Group By. |
| `ChunkBufferPeakMem` | Peak memory usage of the Chunk Buffer. |
| `ChunkBufferPeakSize` | Peak size of the Chunk Buffer. |
| `ExprComputeTime` | Time for expression computation. |
| `ExprReleaseTime` | Time for expression release. |
| `GetResultsTime` | Time to extract aggregate results. |
| `HashTableSize` | Size of the Hash Table. |
| `HashTableMemoryUsage` | Memory size of the Hash Table. |
| `InputRowCount` | Number of input rows. |
| `PassThroughRowCount` | In Auto mode, the number of data rows processed in streaming mode after low aggregation leads to degradation to streaming mode. |
| `ResultAggAppendTime` | Time taken to append aggregate result columns. |
| `ResultGroupByAppendTime` | Time taken to append Group By columns. |
| `ResultIteratorTime` | Time to iterate over the Hash Table. |
| `StreamingTime` | Processing time in streaming mode. |

### Join Operator

**Metrics List**

| Metric | Description |
| - | - |
| `DistributionMode` | Distribution type, including: BROADCAST, PARTITIONED, COLOCATE, etc. |
| `JoinPredicates` | Join predicates. |
| `JoinType` | Join type. |
| `BuildBuckets` | Number of buckets in the Hash Table. |
| `BuildKeysPerBucket` | Number of keys per bucket in the Hash Table. |
| `BuildConjunctEvaluateTime` | Time taken for conjunct evaluation during build phase. |
| `BuildHashTableTime` | Time taken to build the Hash Table. |
| `ProbeConjunctEvaluateTime` | Time taken for conjunct evaluation during probe phase. |
| `SearchHashTableTimer` | Time taken to search the Hash Table. |
| `CopyRightTableChunkTime` | Time taken to copy chunks from the right table. |
| `OutputBuildColumnTime` | Time taken to output the column of build side. |
| `OutputProbeColumnTime` | Time taken to output the column of probe side. |
| `HashTableMemoryUsage` | Memory usage of the Hash Table. |
| `RuntimeFilterBuildTime` | Time taken to build runtime filters. |
| `RuntimeFilterNum` | Number of runtime filters. |

### Window Function Operator

| Metric | Description |
| - | - |
| `ProcessMode` | Execution mode, including two parts: the first part includes Materializing and Streaming; the second part includes Cumulative, RemovableCumulative, ByDefinition. |
| `ComputeTime` | Time taken for window function calculations. |
| `PartitionKeys` | Partition columns. |
| `AggregateFunctions` | Aggregate functions. |
| `ColumnResizeTime` | Time taken for column resizing. |
| `PartitionSearchTime` | Time taken to search partition boundaries. |
| `PeerGroupSearchTime` | Time taken to search Peer Group boundaries. Meaningful only when the window type is `RANGE`. |
| `PeakBufferedRows` | Peak number of rows in the buffer. |
| `RemoveUnusedRowsCount` | Number of times unused buffers are removed. |
| `RemoveUnusedTotalRows` | Total number of rows removed from unused buffers. |

### Sort Operator

| Metric | Description |
| - | - |
| `SortKeys` | Sorting keys. |
| `SortType` | Query result sorting method: full sorting or sorting the top N results. |
| `MaxBufferedBytes` | Peak size of buffered data. |
| `MaxBufferedRows` | Peak number of buffered rows. |
| `NumSortedRuns` | Number of sorted runs. |
| `BuildingTime` | Time taken to maintain internal data structures during sorting. |
| `MergingTime` | Time taken to merge sorted runs during sorting. |
| `SortingTime` | Time taken for sorting. |
| `OutputTime` | Time taken to build the output sorted sequence. |

### Merge Operator

| Metric | Description | Level |
| - | - | - |
| `Limit` | Limit. | Primary |
| `Offset` | Offset. | Primary |
| `StreamingBatchSize` | Size of data processed per Merge operation when Merge is performed in Streaming mode | Primary |
| `LateMaterializationMaxBufferChunkNum` | Maximum number of chunks in the buffer when late materialization is enabled. | Primary |
| `OverallStageCount` | Total execution count of all stages. | Primary |
| `OverallStageTime` | Total execution time for each stage. | Primary |
| `1-InitStageCount` | Execution count of the Init stage. | Secondary |
| `2-PrepareStageCount` | Execution count of the Prepare stage. | Secondary |
| `3-ProcessStageCount` | Execution count of the Process stage. | Secondary |
| `4-SplitChunkStageCount` | Execution count of the SplitChunk stage. | Secondary |
| `5-FetchChunkStageCount` | Execution count of the FetchChunk stage. | Secondary |
| `6-PendingStageCount` | Execution count of the Pending stage. | Secondary |
| `7-FinishedStageCount` | Execution count of the Finished stage. | Secondary |
| `1-InitStageTime` | Execution time for the Init stage. | Secondary |
| `2-PrepareStageTime` | Execution time for the Prepare stage. | Secondary |
| `3-ProcessStageTime` | Execution time for the Process stage. | Secondary |
| `4-SplitChunkStageTime` | Time taken for the Split stage. | Secondary |
| `5-FetchChunkStageTime` | Time taken for the Fetch stage. | Secondary |
| `6-PendingStageTime` | Time taken for the Pending stage. | Secondary |
| `7-FinishedStageTime` | Time taken for the Finished stage. | Secondary |
| `LateMaterializationGenerateOrdinalTime` | Time taken for generating ordinal columns during late materialization. | Tertiary |
| `SortedRunProviderTime` | Time taken to retrieve data from the provider during the Process stage. | Tertiary |

### TableFunction Operator

| Metric | Description |
| - | - |
| `TableFunctionExecTime` | Computation time for the Table Function. |
| `TableFunctionExecCount` | Number of executions for the Table Function. |

### Project Operator

Project Operator is responsible for performing `SELECT <expr>`. If there're some expensive expressions in the query, this operator can take significant time.

| Metric | Description |
| - | - |
| `ExprComputeTime` | Computation time for expressions. |
| `CommonSubExprComputeTime` | Computation time for common sub-expressions. |

### AI Project Operator

AI Project executes asynchronous model calls. Its source operator exposes the following fixed counters in `UniqueMetrics`. Each driver reports only its own completed tasks; profile refreshes replace cumulative values rather than adding them again.

| Metric | Unit | Description |
| - | - | - |
| `AITaskCount` | Tasks | Terminal dispatcher tasks, including success, row failure, and cancellation. SQL NULL rows and rejections before task submission are not counted. |
| `AIRequestCount` | Requests | HTTP submissions accepted for these tasks, including retries. Rejected submissions are not counted. |
| `AIRetryCount` | Requests | Accepted HTTP retry submissions. |
| `AITimeoutCount` | Events | Timeout events recorded by the dispatcher for accepted attempts. |
| `AIErrorCount` | Tasks | Tasks ending in a sanitized row failure. Lifecycle cancellation is not a row failure. |
| `AIHttpTime` | Time | Sum of accepted HTTP attempt durations, from submission to the transport callback. Excludes retry backoff, response parsing, and completion-queue wait time. |
| `AIPromptTokens` | Tokens | Sum of valid provider-reported prompt token counts. |
| `AICompletionTokens` | Tokens | Sum of valid provider-reported completion token counts. |
| `AITotalTokens` | Tokens | Sum of valid provider-reported total token counts; not derived from prompt and completion counts. |
| `AIPromptUsageCount` | Responses | Parsed responses containing a valid prompt token count, including an explicit zero. |
| `AICompletionUsageCount` | Responses | Parsed responses containing a valid completion token count, including an explicit zero. |
| `AITotalUsageCount` | Responses | Parsed responses containing a valid total token count, including an explicit zero. |

All counters, including `AIHttpTime`, aggregate by sum across drivers. Concurrent requests can make this cumulative time exceed query wall-clock time. A task publishes its statistics at terminal completion, so ongoing tasks are not included yet.

AI counters opt into saturating Profile summation: totals stop at the signed 64-bit maximum instead of overflowing. This requires all participating BE and FE Profile mergers to support the optional counter strategy. Older nodes ignore the strategy and retain their existing merge behavior during rolling upgrades. Other counters keep their existing aggregation policies.

A token counter of zero with its corresponding usage count of zero means **unreported**, not zero consumption. A positive usage count does not imply complete provider coverage: missing, invalid, or unparsed response usage is excluded independently for each field. These are observed execution statistics, not token estimates or an exactly-once billing ledger. Query statistics and audit reporting reuse their existing delivery and failure semantics, independently of whether Profile collection is enabled. No prompts, responses, credentials, or model identifiers are added to these counters.

### LocalExchange Operator

| Metric | Description |
| - | - |
| Type | Type of Local Exchange, including: `Passthrough`, `Partition`, and `Broadcast`. |
| `ShuffleNum` | Number of shuffles. This metric is only valid when `Type` is `Partition`. |
| `LocalExchangePeakMemoryUsage` | Peak memory usage. |
| `LocalExchangePeakBufferSize` | Peak size of the buffer. |
| `LocalExchangePeakBufferMemoryUsage` | Peak memory usage of the buffer. |
| `LocalExchangePeakBufferChunkNum` | Peak number of chunks in the buffer. |
| `LocalExchangePeakBufferRowNum` | Peak number of rows in the buffer. |
| `LocalExchangePeakBufferBytes` | Peak size of data in the buffer. |
| `LocalExchangePeakBufferChunkSize` | Peak size of chunks in the buffer. |
| `LocalExchangePeakBufferChunkRowNum` | Peak number of rows per chunk in the buffer. |
| `LocalExchangePeakBufferChunkBytes` | Peak size of data per chunk in the buffer. |

### OlapTableSink Operator

OlapTableSink Operator is responsible for performing the `INSERT INTO <table>` operation.

**Tip**

* An excessive difference between the Max and Min values of the `PushChunkNum` metric of `OlapTableSink` indicates data skew in the upstream operators, which may lead to a bottleneck in loading performance.
* `RpcClientSideTime` equals `RpcServerSideTime` plus network transmission time plus RPC framework processing time. If there is a significant difference between `RpcClientSideTime` and `RpcServerSideTime`, consider enabling compression to reduce transmission time.

| Metric | Description |
| - | - |
| `IndexNum` | Number of the synchronous materialized views created for the destination table. |
| `ReplicatedStorage` | Whether Single Leader Replication is enabled. |
| `TxnID` | ID of the loading transaction. |
| `RowsRead` | Number of rows read from upstream operators. |
| `RowsFiltered` | Number of rows filtered out due to inadequate data quality. |
| `RowsReturned` | Number of rows written to the destination table. |
| `RpcClientSideTime` | Total RPC time consumption for loading recorded by the client side. |
| `RpcServerSideTime` | Total RPC time consumption for loading recorded by the server side. |
| `PrepareDataTime` | Total time consumption for the data preparation phase, including data format conversion and data quality check. |
| `SendDataTime` | Local time consumption for sending the data, including time for serializing and compressing data, and for submitting tasks to the sender queue. |
| `RawInputBytes` | In-memory size of the chunk data passed to serialization. |
| `SerializedBytes` | Size of the serialized chunk data before compression. Because `load_transmission_compression_type` defaults to `NO_COMPRESSION`, this is normally also the number of bytes sent over the network. |
| `CompressedInputBytes` | Size of the serialized (pre-compression) data that was actually fed to the compressor. Chunks skipped because compression is disabled, or because the input exceeds the RPC compression size limit, are not counted. |
| `CompressedBytes` | Size of the compressed chunk data. Only chunks that were actually compressed are counted, so both this metric and `CompressedInputBytes` are `0` under the default `NO_COMPRESSION`. `CompressedInputBytes / CompressedBytes` gives the compression ratio, and `SerializedBytes - CompressedInputBytes` is the size of the data that was not compressed. |

### Spill Metrics

When a query exceeds its memory budget, the spillable operators write intermediate data to disk or
to remote storage. Every one of them publishes the same counter group, `SpillStatistics`, inside its
own operator profile: the spillable aggregate and distinct operators, the hash join and nested loop
join build and probe operators, and the sort operator.

Which counters are non-zero depends on which of the three writers the operator uses:

* **Sorted** — the blocking aggregate and blocking `DISTINCT` operators, which sort by the `GROUP BY`
  expressions, and the sort operator, which sorts by the `ORDER BY` expressions. Each mem-table is
  sorted and written out as one sorted block group; once enough of them accumulate, they are merged
  back into one. This is the only writer with a compaction stage. `SortChunkTime` and `MaterializeChunkTime`
  are non-zero only here, and so are `CompactTime`, `CompactMergeTime`, `CompactCount`,
  `CompactBlockCount`, `CompactBytesRead`, and `CompactBytesWritten` — and those only when block
  compaction is enabled, which today means the blocking aggregate operator and the sort operator.
* **Partitioned** — the hash join build and probe operators and the partition-wise aggregate and
  `DISTINCT` operators. Rows are hash-partitioned and each partition is written out on its own;
  there is no compaction stage. A partition that grows past the mem-table limit is split in two
  instead, and that work is counted under `SplitPartitionTime` rather than `FlushTime`.
  `ShuffleTime`, `SplitPartitionTime`, `PartitionWriterPeakMemoryBytes`, and the `SkewMemTable*`
  counters are non-zero only here.
* **Unordered** — the nested loop join build and probe operators. Mem-tables are written out as
  they are, with no sorting, no partitioning, and no compaction.

`FlushMemTableTime` measures the first write-out and is reported by the sorted and the unordered
writer. The partitioned writer has no such stage and leaves it at zero.

#### Counter tree

```text theme={null}
SpillStatistics
├── AppendDataTime
├── RowsSpilled
├── FlushTime
│   ├── FlushMemTableTime
│   └── CompactTime
│       └── CompactMergeTime
├── WriteIOTime
│   ├── LocalWriteIOTime
│   └── RemoteWriteIOTime
├── RowsRestored
├── RestoreTime
├── ReadIOTime
│   ├── LocalReadIOTime
│   └── RemoteReadIOTime
├── BytesFlush
│   ├── BytesFlushToLocalDisk
│   └── BytesFlushToRemoteStorage
├── BytesRestore
│   ├── BytesRestoreFromLocalDisk
│   └── BytesRestoreFromRemoteStorage
├── SerializeTime
├── DeserializeTime
├── MemTablePeakMemoryBytes
├── InputStreamPeakMemoryBytes
├── SortChunkTime
├── MaterializeChunkTime
├── ShuffleTime
├── SplitPartitionTime
├── PartitionWriterPeakMemoryBytes
├── RowsRestoreFromMemTable
├── BytesRestoreFromMemTable
├── BlockCount
│   ├── LocalBlockCount
│   └── RemoteBlockCount
├── ReadIOCount
│   ├── LocalReadIOCount
│   └── RemoteReadIOCount
├── CompactCount
├── CompactBlockCount
├── CompactBytesRead
├── CompactBytesWritten
├── FlushIOTaskCount
├── PeakFlushIOTaskCount
├── RestoreIOTaskCount
├── PeakRestoreIOTaskCount
├── MemTableFinalizeTime
├── FlushIOTaskYieldCount
├── RestoreIOTaskYieldCount
└── SkewMemTableCount / SkewMemTableSkewRatio / SkewMemTableMergeTime /
    SkewMemTableInputRows / SkewMemTableOutputRows /
    SkewMemTableInputBytes / SkewMemTableOutputBytes
```

Nesting in this tree means "is part of" only where the description says so. Several counters are
siblings in the tree but still overlap in time, because the same work is charged to more than one
of them. See [Overlapping counters](#overlapping-counters).

**Note**

`WriteIOTime`, `ReadIOTime`, `BytesFlush`, `BytesRestore`, `BlockCount`, and `ReadIOCount` are
grouping rows for query spill: the value is always charged to the `Local...` or `Remote...` child
that matches where the block lives, and the parent row stays at `0`. Read the totals from the
children.

#### Accepting rows

These counters are charged to the operator's own thread, so they are part of the operator's time.

| Metric | Description | Writer |
| - | - | - |
| `AppendDataTime` | Time to accept a chunk into the spiller: appending it to the in-memory mem-table and, on the partitioned path, distributing its rows across partitions. | All |
| `RowsSpilled` | Number of rows accepted by the spiller. | All |
| `ShuffleTime` | Time to compute the target partition of each row and copy the rows into the matching partition mem-tables. Part of `AppendDataTime`. | Partitioned |
| `SortChunkTime` | Time to sort a full mem-table by the sort keys. Charged when the flush is triggered, before the flush task is submitted. | Sorted |
| `MaterializeChunkTime` | Time to rebuild the mem-table chunk in sorted order from the sort permutation. Charged together with `SortChunkTime`. | Sorted |
| `MemTablePeakMemoryBytes` | Peak memory held by mem-tables. | All |
| `PartitionWriterPeakMemoryBytes` | Peak memory held by the partitioned writer across all of its partitions. | Partitioned |
| `SkewMemTableCount` | Number of mem-tables whose rows were merged because one group-by value dominated them. Requires an operator that supplies a skew compactor. | Partitioned |
| `SkewMemTableSkewRatio` | Percentage of mem-table bytes removed by that merge, reported as the lowest ratio observed. | Partitioned |
| `SkewMemTableMergeTime` | Time spent merging skewed mem-tables. | Partitioned |
| `SkewMemTableInputRows` / `SkewMemTableOutputRows` | Rows before and after the skew merge. | Partitioned |
| `SkewMemTableInputBytes` / `SkewMemTableOutputBytes` | Mem-table bytes before and after the skew merge. | Partitioned |

#### Writing data out

These counters are charged to the spill I/O threads. They run asynchronously, so they do not add to
the operator's time directly; they slow the query down when the operator has to wait for a free
mem-table.

| Metric | Description | Writer |
| - | - | - |
| `FlushTime` | Total time of the flush task. With the sorted writer it is `FlushMemTableTime` plus `CompactTime`; with the unordered writer it is `FlushMemTableTime` alone; with the partitioned writer it covers writing out each full partition and has no sub-stages. | All |
| `FlushMemTableTime` | Time to write one finalized mem-table out as a new block group. | Sorted, unordered |
| `CompactTime` | Time to merge several sorted block groups into one. Zero when block compaction is disabled, or when the number of runs never reaches the merge threshold. | Sorted |
| `CompactMergeTime` | The merge itself: comparing sort keys and assembling the merged chunk. | Sorted |
| `MemTableFinalizeTime` | Time inside the mem-table's serialize loop. It runs within `FlushMemTableTime` with the sorted and the unordered writer, and directly within `FlushTime` with the partitioned writer. | All |
| `SerializeTime` | Time to serialize chunks before they are written out. | All |
| `WriteIOTime` | Time spent appending to and flushing a block. Read the `LocalWriteIOTime` and `RemoteWriteIOTime` children. | All |
| `BytesFlush` | Bytes written out. Read the `BytesFlushToLocalDisk` and `BytesFlushToRemoteStorage` children. | All |
| `BlockCount` | Number of blocks allocated. Read the `LocalBlockCount` and `RemoteBlockCount` children. | All |
| `FlushIOTaskCount` | Number of flush I/O tasks submitted. | All |
| `PeakFlushIOTaskCount` | Highest number of flush tasks in flight at one time. | All |
| `FlushIOTaskYieldCount` | Number of times a flush task used up its time slice and was resubmitted to finish later. | All |
| `SplitPartitionTime` | Time to split partitions that outgrew the mem-table limit, including reading each one back and writing out the two halves. Not part of `FlushTime`. | Partitioned |

#### Compaction

| Metric | Description | Writer |
| - | - | - |
| `CompactCount` | Number of compaction rounds. | Sorted |
| `CompactBlockCount` | Number of *block groups* fed into those rounds. Despite the name it counts block groups, not blocks. | Sorted |
| `CompactBytesRead` | Bytes read back by compaction. A subset of `BytesRestore`. | Sorted |
| `CompactBytesWritten` | Bytes rewritten by compaction. A subset of `BytesFlush`. | Sorted |

#### Reading data back

| Metric | Description | Writer |
| - | - | - |
| `RestoreTime` | Time to take the next chunk out of the prefetch buffer and start the next prefetch. Charged to the operator's own thread. | All |
| `RowsRestored` | Number of rows handed back to the operator. | All |
| `DeserializeTime` | Time to deserialize chunks read back from a block. | All |
| `ReadIOTime` | Time spent reading blocks. Read the `LocalReadIOTime` and `RemoteReadIOTime` children. | All |
| `ReadIOCount` | Number of read operations. Read the `LocalReadIOCount` and `RemoteReadIOCount` children. | All |
| `BytesRestore` | Bytes read back. Read the `BytesRestoreFromLocalDisk` and `BytesRestoreFromRemoteStorage` children. | All |
| `InputStreamPeakMemoryBytes` | Peak memory held by chunks that have been prefetched but not yet consumed. | All |
| `RestoreIOTaskCount` | Number of restore I/O tasks submitted. | All |
| `PeakRestoreIOTaskCount` | Highest number of restore tasks in flight at one time. | All |
| `RestoreIOTaskYieldCount` | Number of times a restore task used up its time slice and was resubmitted to finish later. | All |
| `RowsRestoreFromMemTable` / `BytesRestoreFromMemTable` | Reserved for rows served straight from a partition that never left memory. Not updated by the current implementation, so always `0`. | Partitioned |

#### Overlapping counters

Several counters cover the same work, so adding them up double-counts:

* `MemTableFinalizeTime` contains the `SerializeTime` and write I/O of the mem-table it is writing
  out. It is a stage boundary, not an extra cost.
* `SerializeTime`, `WriteIOTime`, and `BytesFlush` count both the first write-out and the
  compaction rewrite. `CompactBytesWritten` is the compaction share of `BytesFlush`.
* `DeserializeTime`, `ReadIOTime`, `ReadIOCount`, and `BytesRestore` are shared by restore and by
  compaction, which reads its input back through the same path. `CompactBytesRead` is the
  compaction share of `BytesRestore`; subtract it from `BytesRestore` to get what restore itself
  read.
* `CompactMergeTime` does **not** overlap `DeserializeTime` or `ReadIOTime`. The merge only takes
  chunks that a prefetch has already placed in the input buffer; the read and the deserialization
  that fill that buffer are charged separately.

#### How to read these counters

1. **Start from `FlushTime`.** When spilling dominates a query, `FlushTime` is usually the largest
   value in the group, and the upstream operator's wait time typically tracks it.

2. **Split `FlushTime` into its two stages** (sorted writer only):
   `FlushTime` = `FlushMemTableTime` + `CompactTime`.

   * `FlushMemTableTime` dominates: writing the data out the first time is the cost. Compare
     `SerializeTime` against `LocalWriteIOTime` and `RemoteWriteIOTime` to tell CPU-bound
     serialization from a slow device, and check `BytesFlush` for how much data is involved. A wide
     table, or one whose columns are mostly NULL, makes serialization the larger of the two.
   * `CompactTime` dominates: the query keeps producing enough sorted block groups to hit the merge
     threshold, and the same data is being rewritten. `CompactCount` is the number of rounds and
     `CompactBlockCount` the number of block groups they consumed. `CompactBytesRead` and
     `CompactBytesWritten` against `BytesRestore` and `BytesFlush` give the write amplification
     compaction adds; when they approach the totals, most of the I/O is rewriting rather than
     making progress.

3. **Look at `CompactMergeTime` inside `CompactTime`.** It is the merge itself, so its share says
   where compaction is stuck:

   * A high share means the merge is CPU-bound. Many sort columns, wide chunks, or many block groups
     merged at once all push key comparison and chunk assembly up.
   * A low share means the merge is waiting on its input or its output. The rest of `CompactTime`
     is then the read side (`ReadIOTime`, `DeserializeTime`) or the write side (`SerializeTime`,
     `WriteIOTime`), and those counters say which.

4. **Check for concurrency limits.** `PeakFlushIOTaskCount` and `PeakRestoreIOTaskCount` show how
   many I/O tasks ever ran at once; a high `FlushIOTaskYieldCount` means flush tasks repeatedly ran
   out of their time slice and had to be resubmitted.

5. **Do not add overlapping counters together.** See
   [Overlapping counters](#overlapping-counters) before treating the group as a breakdown of
   `FlushTime`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.