Syntax
Copy DESCRIBE QUERY METRICS [query_id | query_name[:query_version]]
[WITH (query_metrics_parameter = value [, ...])];
Description
This command provides a snapshot of metrics for a Streaming or Continuous Query .
The four metrics that are shown are NumRecordsInPerSecond
, NumRecordsOutPerSecond
, NumBytesInPerSecond
, and NumBytesOutPerSecond
. Returned metrics represent a snapshot of the value of each metric at the time this command was ran.
Metrics may not always be available for Queries, and when unavailable the stats will be replaced with n/a
or with a 02000
SQL error code. See the example below with a Query that in a terminated state.
See Query on how streaming queries operate in DeltaStream.
The Query will only be visible 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 that the user has access to. 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 that the user has access to. 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 that the user has access to. The column (Version
) in the response corresponds with the query_version
. If query_name
is provided without a query_version
, the latest query_version
will be used.
WITH (query_metrics_parameter = value [, ...])
Optionally, this clause specifies Query Metrics Parameters .
Query Metrics Parameters
Parameter Name Description Specifies the list of Query metrics names to describe.
Required: Yes
Type: METRICS_NAME
Valid values: numRecordsInPerSecond
, numRecordsOutPerSecond
, numBytesInPerSecond
, numBytesOutPerSecond
, consumerRecordsLagMax
How far in the past to to return metrics data points from.
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
:
Copy demodb.analytics/demostore# DESCRIBE QUERY METRICS b2041101-c37c-4807-93d4-2de876b7bd39 ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | 6 |
+------------------------+--------+
| NumRecordsOutPerSecond | 5 |
+------------------------+--------+
| NumBytesInPerSecond | 6870 |
+------------------------+--------+
| NumBytesOutPerSecond | 4690 |
+------------------------+--------+
demodb.analytics/demostore# DESCRIBE QUERY METRICS demoquery:1 ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | 6 |
+------------------------+--------+
| NumRecordsOutPerSecond | 5 |
+------------------------+--------+
| NumBytesInPerSecond | 6870 |
+------------------------+--------+
| NumBytesOutPerSecond | 4690 |
+------------------------+--------+
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:
Copy demodb.analytics/demostore# DESCRIBE QUERY METRICS c81fc632-a043-472d-a1fe-aa81bc9078df ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | 20 |
+------------------------+--------+
| NumRecordsOutPerSecond | 25 |
+------------------------+--------+
| NumBytesInPerSecond | 16870 |
+------------------------+--------+
| NumBytesOutPerSecond | 10690 |
+------------------------+--------+
demodb.analytics/demostore# DESCRIBE QUERY METRICS demoquery:1 ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | 20 |
+------------------------+--------+
| NumRecordsOutPerSecond | 25 |
+------------------------+--------+
| NumBytesInPerSecond | 16870 |
+------------------------+--------+
| NumBytesOutPerSecond | 10690 |
+------------------------+--------+
Describe an ERRORED query
The following describes a query that was stopped due to an unrecoverable failure, leaving it in the ERRORED
state:
Copy demodb.analytics/demostore# DESCRIBE QUERY METRICS c81fc632-a043-472d-a1fe-aa81bc9078df ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | n/a |
+------------------------+--------+
| NumRecordsOutPerSecond | n/a |
+------------------------+--------+
| NumBytesInPerSecond | n/a |
+------------------------+--------+
| NumBytesOutPerSecond | n/a |
+------------------------+--------+
demodb.analytics/demostore# DESCRIBE QUERY METRICS demoquery:1 ;
+------------------------+--------+
| Key | Value |
+ ========================+========+
| NumRecordsInPerSecond | n/a |
+------------------------+--------+
| NumRecordsOutPerSecond | n/a |
+------------------------+--------+
| NumBytesInPerSecond | n/a |
+------------------------+--------+
| NumBytesOutPerSecond | n/a |
+------------------------+--------+
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
:
Copy demodb.public/demostore# DESCRIBE QUERY METRICS 9c36c3c1-c45e-42ff-b2e4-2e069b313ac3 WITH ('from' = LAST 15 MINUTES , FOR METRICS (numRecordsInPerSecond, numRecordsOutPerSecond, numBytesInPerSecond, numBytesOutPerSecond, consumerRecordsLagMax));
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| Name | Reference Name | Values |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numRecordsInPerSecond | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"6"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numRecordsInPerSecond | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"1"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"1"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numRecordsOutPerSecond | KafkaSink:mr_metrics_082124:_Writer | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"6"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numBytesInPerSecond | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"570 B"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"532 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numBytesInPerSecond | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"177 B"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"169 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| numBytesOutPerSecond | KafkaSink:mr_metrics_082124:_Writer | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"931 B"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"942 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| consumerRecordsLagMax | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"0"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| consumerRecordsLagMax | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T16:12:34.692-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:27:34.692-07:00","Value":"0"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
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
:
Copy demodb.public/demostore# DESCRIBE QUERY METRICS 9c36c3c1-c45e-42ff-b2e4-2e069b313ac3 WITH ('from' = LAST 3 HOURS, FOR METRICS (numRecordsInPerSecond, numRecordsOutPerSecond, numBytesInPerSecond, numBytesOutPerSecond, consumerRecordsLagMax));
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Name | Reference Name | Values |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numRecordsInPerSecond | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"2"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"4"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numRecordsInPerSecond | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"1"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"1"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numRecordsOutPerSecond | KafkaSink:mr_metrics_082124:_Writer | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"2"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"6"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"5"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"4"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"6"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"5"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numBytesInPerSecond | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"426 B"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"169 B"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"492 B"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"447 B"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"418 B"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"495 B"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"495 B"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"402 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numBytesInPerSecond | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"138 B"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"69 B"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"165 B"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"142 B"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"138 B"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"153 B"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"157 B"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"119 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| numBytesOutPerSecond | KafkaSink:mr_metrics_082124:_Writer | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"787 B"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"243 B"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"904 B"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"729 B"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"578 B"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"950 B"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"872 B"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"714 B"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| consumerRecordsLagMax | Source:_KafkaSource:pv | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"0"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| consumerRecordsLagMax | Source:_KafkaSource:users_log | [{"Timestamp":"2024-08-21T14:43:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T14:58:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:13:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:28:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:43:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T15:58:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:13:22.883-07:00","Value":"0"},{"Timestamp":"2024-08-21T16:28:22.883-07:00","Value":"0"}] |
+------------------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Describe metrics for a Query in the STOPPED
state
The following example show that when a Query is in a terminated state, STOPPED
in this case, a SQL code of 02000
will be returned instead:
Copy 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: ... )