Querying in ClickHouse CloudThe data in this system table is held locally on each node in ClickHouse Cloud. Obtaining a complete view of all data, therefore, requires the
clusterAllReplicas function. See here for further details.Description
This table contains profiling on processors level (that you can find inEXPLAIN PIPELINE).
It is safe to truncate or drop this table at any time.
Columns
hostname(LowCardinality(String)) — Hostname of the server executing the query.clickhouse_version(LowCardinality(String)) — Version of the ClickHouse server that produced the row.system_processor(LowCardinality(String)) — CPU architecture of the ClickHouse server that produced the row.event_date(Date) — The date when the event happened.event_time(DateTime) — The date and time when the event happened.event_time_microseconds(DateTime64(6)) — The date and time with microseconds precision when the event happened.id(UInt64) — ID of processor, unique within the query. It is the number inprocessor_uniq_id.parent_ids(Array(UInt64)) — Parent processors IDs.plan_step(UInt64) — ID of the query plan step which created this processor, unique within the query. It is one plus the number instep_uniq_id. The value is zero if the processor was not added from any step.plan_step_name(String) — Name of the query plan step which created this processor. The value is empty if the processor was not added from any step.plan_step_description(String) — Description of the query plan step which created this processor. The value is empty if the processor was not added from any step.plan_group(UInt64) — Group of the processor if it was created by query plan step. A group is a logical partitioning of processors added from the same query plan step. Group is used only for beautifying the result of EXPLAIN PIPELINE result.initial_query_id(String) — ID of the initial query in the same query chain.query_id(String) — ID of the query.name(LowCardinality(String)) — Name of the processor.elapsed_us(UInt64) — Number of microseconds this processor was executed.input_wait_elapsed_us(UInt64) — Number of microseconds this processor was waiting for data (from other processor).output_wait_elapsed_us(UInt64) — Number of microseconds this processor was waiting because output port was full.input_rows(UInt64) — The number of rows consumed by processor.input_bytes(UInt64) — The number of bytes consumed by processor.output_rows(UInt64) — The number of rows generated by processor.output_bytes(UInt64) — The number of bytes generated by processor.processor_uniq_id(String) — The uniq processor id in pipeline.step_uniq_id(String) — The uniq step id in plan.exception_code(Int32) — Code of the exception if the query failed, otherwise 0.exception(String) — Message of the exception if the query failed, otherwise empty.
Example
Query
Response
ExpressionTransformwas executingsleep(1)function, so itworkwill takes 1e6, and soelapsed_us> 1e6.SourceFromSingleChunkneed to wait, becauseExpressionTransformdoes not accept any data during execution ofsleep(1), so it will be inPortFullstate for 1e6 us, and sooutput_wait_elapsed_us> 1e6.LimitsCheckingTransform/NullSource/LazyOutputFormatneed to wait untilExpressionTransformwill executesleep(1)to process the result, soinput_wait_elapsed_us> 1e6.
Profiling a join
When a query reads from several tables, every table has its own read pipeline, and rows pass through many processors on their way to the result. Summinginput_rows or output_rows over all processors therefore counts the same rows several times and does not tell how much was read from each table.
The following example uses two MergeTree tables of different sizes on a single server.
Query
EXPLAIN PIPELINE shows one read pipeline for each side of the join (ReadFromMergeTree, with MergeTreeSelect sources below it), connected by the join processors. join_algorithm = 'hash' and enable_join_runtime_filters = 0 make this example reproducible: a join runtime filter cannot prune big before its source emits rows.
Query
- Look at the source processors, whose
nameisMergeTreeSelect(...)(orMergeTreeSource) and whoseplan_step_nameisReadFromMergeTree. Theiroutput_rowsis the number of rows each source produced. Sum it per read step (plan_step), not over the whole query. The value is the number of rows that the read step passed on to the rest of the pipeline. - Each side of the join has its own
ReadFromMergeTreestep with a differentplan_step. In the rows from this execution,parent_idslists the IDs of downstream processors. Starting from a source, recursively match everyparent_idsvalue to anidin the samequery_idto follow the branch towards the join. This identifies, for example, the branch that feedsFillingRightJoinSide. - Processors above the sources (for example
ExpressionTransform,FillingRightJoinSide,ConcatProcessor, or the join transform itself) consume and produce rows derived from the sources. Do not add their counters to the source counters, because that counts the same rows again. - The step information is not always enough to identify a source.
EXPLAIN PIPELINEis a separate plan: it helps compare processor names and branch shapes, but its plain-text output has neither the loggedidvalues norparent_ids. If both tables have similar step descriptions, use the graph from the executed query and the known row counts. In this example, the read sources forbigsum to 1,000,000 rows and those forsmallsum to 1,000 rows. - The row and byte counters of processors describe the data passing through the pipeline, not physical storage reads. They do not include granules or marks that were read and then filtered out, they are affected by the primary key and other index filtering,
PREWHERE, and column pruning, and they do not reflect compressed bytes read from disk.SelectedRows,SelectedBytes, andSelectedMarksinsystem.query_logare logical selection statistics: they can be nonzero when all data comes from cache. To investigate file reads, useReadBufferFromFileDescriptorReadBytes, which includes reads served by the OS page cache. To investigate local disk or block-device reads that exclude the OS page cache, useOSReadBytes.