Skip to main content
Edit this page

query_metric_log

Querying in ClickHouse Cloud

The 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.

Contains history of memory and metric values from table system.events for individual queries, periodically flushed to disk.

Once a query starts, data is collected at periodic intervals of query_metric_log_interval milliseconds (which is set to 1000 by default). The data is also collected when the query finishes if the query takes longer than query_metric_log_interval.

Columns:

  • query_id (String) — ID of the query.
  • hostname (LowCardinality(String)) — Hostname of the server executing the query.
  • event_date (Date) — Event date.
  • event_time (DateTime) — Event time.
  • event_time_microseconds (DateTime64) — Event time with microseconds resolution.

Example

SELECT * FROM system.query_metric_log LIMIT 1 FORMAT Vertical;
Row 1:
──────
query_id: 97c8ba04-b6d4-4bd7-b13e-6201c5c6e49d
hostname: clickhouse.eu-central1.internal
event_date: 2020-09-05
event_time: 2020-09-05 16:22:33
event_time_microseconds: 2020-09-05 16:22:33.196807
memory_usage: 313434219
peak_memory_usage: 598951986
ProfileEvent_Query: 0
ProfileEvent_SelectQuery: 0
ProfileEvent_InsertQuery: 0
ProfileEvent_FailedQuery: 0
ProfileEvent_FailedSelectQuery: 0
...

See also