Returned metrics represent a snapshot of the value of each metric at the time this command was run.
Note Metrics may not always be available for queries. In this case, stats are replaced with n/a or with a 02000 SQL error code. The example below displays a query in a terminal state.
See Query on how streaming queries operate in DeltaStream.
The query is visible only if the current role has USAGE privileges.
Arguments
query_id
This is the unique identifier of the query to describe. See LIST QUERIES to find out how to list all queries to which the user has access. The first column (ID) in the response corresponds with the query_id.
query_name
This is the name of the query to describe. See LIST QUERIES to find out how to list all queries to which the user has access. The column (Name) in the response corresponds with the query_name. The query_version property disambiguates between multiple queries with the same name.
query_version
This is the version of the query to describe. See LIST QUERIES to find out how to list all queries to which the user has access. The column (Version) in the response corresponds with the query_version. If query_name is provided without a query_version, the latest query_version is used.
How far in the past from which to return metrics data points.
Required: Yes
Type:METRICS_RANGE
Valid values:LAST 15 MINUTES, LAST 30 MINUTES, LAST HOUR, LAST 3 HOURS, LAST 6 HOURS, LAST 12 HOURS, LAST DAY
Examples
Describe a simple query
The following describes a simple query with a Changelog source relation, users_log, filtering on a userid column and writing the results into a Changelog sink relation, users2468_log:
Describe a multi-source query
The following describes a JOIN query that joins a Stream, pageviews, and a Changelog relation, users_log, on a userid column and writes the resulting records into a pv_user2468_interest Changelog relation:
Describe an ERRORED query
The following describes a query stopped due to an unrecoverable failure, leaving it in the ERRORED state:
Describe a query's metrics from the last 15 minutes
The following example shows metrics data points available from the last 15 minutes of a given query for the metrics name numRecordsInPerSecond, numRecordsOutPerSecond, numBytesInPerSecond, numBytesOutPerSecond, and consumerRecordsLagMax:
Describe a query's metrics from the last 3 hours
The following example shows metrics data points available from the last 15 minutes of a given query for the metrics name numRecordsInPerSecond, numRecordsOutPerSecond, numBytesInPerSecond, numBytesOutPerSecond, and consumerRecordsLagMax:
Describe metrics for a query in the STOPPED state
The following example show that when a query is in a terminated state — in this case, STOPPED — the system returns a SQL code of 02000 instead:
demodb.public/demostore# DESCRIBE QUERY METRICS 4f5f6a0f-1f71-40ec-902a-0ec821bc36f3 WITH ('from' = LAST 3 HOURS, FOR METRICS (numRecordsInPerSecond));
sql error: no data found (SQLState: 02000) (request ID: ...)