queries command returns a list of queries that have reached a final state, and that the user invoking the command has access to see:
- A database admin or database monitor can see any command that was invoked on their database.
- Other users can only see queries that were invoked by them.
- To see both queries and commands completion, use .show queries-and-commands
- Returns a table containing previously run queries and their completion statistics. You can use KQL queries to explore the results.
- Note: the text of the query is truncated after 64KB.
The output schema is as follows:
|ClientActivityId||string||Client ID of the request|
|Text||string||Query text, truncated at 64 KB|
|Database||string||Name of the database on which the query was executed|
|StartedOn||datetime||Timestamp when query execution started|
|LastUpdatedOn||datetime||Timestamp of the last status update|
|Duration||timespan||Server-side query duration|
|RootActivityId||guid||Server-side request ID|
|User||string||User ID that ran the query|
|FailureReason||string||Failure reason. If query succeeded, this field is empty.|
|TotalCpu||timespan||Total CPU consumed by the query|
|CacheStatistics||dynamic||Data-cache usage statistics|
|Application||string||Name of the application that was used to run the query|
|MemoryPeak||long||Peak memory statistics|
|ScannedExtentsStatistics||dynamic||Statistics of the scanned shards (extents)|
|Principal||string||AAD-ID of the user or application that was used to run the query|
|ClientRequestProperties||dynamic||Client request properties|
|ResultSetStatistics||dynamic||Statistics describing returned data set|
|WorkloadGroup||string||Name of the workload group that query was associated with|
.show queries | project Text, Duration | take 3
|T | summarize count() by column1||00:00:00.0312564|
|T | take 10||00:00:00.0155632|
.show running queries
queries command returns a list of currently-executing queries
by the user, or by another user, or by all users.
.show running queries
- Returns the currently-executing queries by the invoking user (requires read access).
query command starts a best-effort attempt to cancel a specific
- Cluster admins can cancel any running query.
- Database admins can cancel any running query that was invoked on a database they have admin access on.
- All principals can cancel running queries that they started.
query ClientRequestId [
ClientRequestId is the value of the running query's
ClientRequestIdproperty, as a
ReasonPhrase: If specified, a
stringliteral that describes the reason for canceling the running query. This information is included in the query results if it's successfully canceled.
.cancel query "KE.RunQuery;8f70e9ab-958f-4955-99df-d2a288b32b2c"
Submit and view feedback for