Skip to main content
Version: Latest-4.0

Query detail API

The query detail API returns recent query execution details that are cached in FE memory.

note

Query detail records are collected only when the FE configuration enable_collect_query_detail_info is set to true.

Endpoints​

  • GET /api/query_detail (v1)
  • GET /api/v2/query_detail (v2, supports is_request_all_frontend and returns a wrapped result)

Parameters​

NameRequiredDefaultDescription
event_timeYes-Lower bound filter. Returns items whose eventTime is greater than this value. You can pass 0 to get all cached items.
userNo-Filter by the user field. Case-insensitive match.
is_request_all_frontendNo (v2 only)falseWhen true, the current FE queries other alive FEs and merges their results.

Response​

  • v1 returns a JSON array of QueryDetail objects.
  • v2 returns { "code": "0", "message": "OK", "result": [ ... ] } where result is a QueryDetail list.

Authentication and authorization​

This API requires HTTP Basic authentication. There is no additional privilege check beyond a successful login. Any authenticated user can access the endpoint and can view all cached query details unless a user filter is applied.

QueryDetail fields​

FieldTypeDescription
queryIdstringQuery ID.
eventTimelongInternal timestamp used for filtering. Monotonic nanosecond timestamp derived from wall-clock time.
isQuerybooleanWhether the statement is a query.
remoteIPstringClient IP address or System.
connIdintConnection ID.
startTimelongQuery start time in milliseconds since epoch.
endTimelongQuery end time in milliseconds since epoch. -1 if not finished.
latencylongQuery latency in milliseconds. -1 if not finished.
pendingTimelongPending time in milliseconds.
netTimelongNet execution time in milliseconds.
netComputeTimelongNet compute time in milliseconds.
statestringOne of RUNNING, FINISHED, FAILED, CANCELLED.
databasestringCurrent database.
sqlstringSQL text (may be desensitized if configured).
userstringLogin user (qualified user).
impersonatedUserstringTarget user of EXECUTE AS. null if not executing as another user.
errorMessagestringError message when failed.
explainstringExplain plan (level controlled by query_detail_explain_level).
profilestringProfile text if collected.
resourceGroupNamestringResource group name.
scanRowslongScanned rows.
scanByteslongScanned bytes.
returnRowslongReturned rows.
cpuCostNslongCPU cost in nanoseconds.
memCostByteslongMemory cost in bytes.
spillByteslongSpill bytes.
cacheMissRatiofloatCache miss ratio in percent (0-100).
warehousestringWarehouse name.
digeststringSQL digest.
catalogstringCatalog name.
commandstringMySQL command name.
preparedStmtIdstringPrepared statement ID.
queryFeMemorylongFE memory allocated by the query, in bytes.
querySourcestringQuery source: EXTERNAL, INTERNAL, MV, or TASK.

Examples​

v1​

curl -u root: "http://<fe_host>:<fe_http_port>/api/query_detail?event_time=0"

v2​

curl -u root: "http://<fe_host>:<fe_http_port>/api/v2/query_detail?event_time=0&is_request_all_frontend=true"
Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.