Skip to main content
Version: 1.3

slow_queries

The slow_queries table records SQL and PromQL queries selected by the slow-query recorder. When the slow-query recorder writes to greptime_private.slow_queries, it creates the table if it does not exist and adds any missing columns to an existing table. It performs both actions even when automatic table creation is disabled.

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.