Skip to main content
Version: 1.2

slow_queries

The slow_queries table records SQL and PromQL queries selected by the slow-query recorder.

NOTE

The slow_queries table requires slow query logging to be enabled. See Slow Query for configuration details.

USE greptime_private;

SELECT *
FROM slow_queries
ORDER BY timestamp DESC;
ColumnTypeDescription
typeStringEvent type. Slow-query rows use slow_query.
payloadJsonStructured diagnostic context attached to the event. It can be JSON null.
timestampTimestampNanosecondTime when the query event was recorded.
costUInt64Query duration in milliseconds.
thresholdUInt64Slow-query threshold in milliseconds.
queryStringSQL statement, PromQL expression, or planned query text.
is_promqlBooleanWhether the row describes a PromQL query.
promql_rangeUInt64PromQL query range in milliseconds; 0 for non-PromQL queries.
promql_stepUInt64PromQL step in milliseconds; 0 for non-PromQL queries.
promql_startTimestampMillisecondPromQL range start; Unix epoch for non-PromQL queries.
promql_endTimestampMillisecondPromQL range end; Unix epoch for non-PromQL queries.
schema_nameStringDatabase schema in which the query ran.

See Slow Query for configuration and retention behavior.