Skip to content

aws.athena.get_query_runtime_statistics

Example SQL Queries

SELECT * FROM
aws.athena.get_query_runtime_statistics
WHERE
"query_execution_id" = 'VALUE';

Description

Returns query execution runtime statistics related to a single execution of a query if you have access to the workgroup in which the query ran. Statistics from the Timeline section of the response object are available as soon as QueryExecutionStatus$State is in a SUCCEEDED or FAILED state. The remaining non-timeline statistics in the response (like stage-level input and output row count and data size) are updated asynchronously and may not be available immediately after a query completes. The non-timeline statistics are also not included when a query has row-level filters defined in Lake Formation.

Table Definition

Column NameColumn Data Type
query_execution_id Required Input Column

The unique ID of the query execution.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
query_runtime_statistics

Runtime statistics about the query execution.

STRUCT(
"timeline" STRUCT(
"query_queue_time_in_millis" BIGINT,
"service_pre_processing_time_in_millis" BIGINT,
"query_planning_time_in_millis" BIGINT,
"engine_execution_time_in_millis" BIGINT,
"service_processing_time_in_millis" BIGINT,
"total_execution_time_in_millis" BIGINT
),
"rows" STRUCT(
"input_rows" BIGINT,
"input_bytes" BIGINT,
"output_bytes" BIGINT,
"output_rows" BIGINT
),
"output_stage" STRUCT(
"stage_id" BIGINT,
"state" VARCHAR,
"output_bytes" BIGINT,
"output_rows" BIGINT,
"input_bytes" BIGINT,
"input_rows" BIGINT,
"execution_time" BIGINT,
"query_stage_plan" STRUCT(
"name" VARCHAR,
"identifier" VARCHAR,
"remote_sources" VARCHAR[]
)
)
)
Show child fields
query_runtime_statistics.output_stage

Stage statistics such as input and output rows and bytes, execution time, and stage state. This information also includes substages and the query stage plan.

Show child fields
query_runtime_statistics.output_stage.execution_time

Time taken to execute this stage.

query_runtime_statistics.output_stage.input_bytes

The number of bytes input into the stage for execution.

query_runtime_statistics.output_stage.input_rows

The number of rows input into the stage for execution.

query_runtime_statistics.output_stage.output_bytes

The number of bytes output from the stage after execution.

query_runtime_statistics.output_stage.output_rows

The number of rows output from the stage after execution.

query_runtime_statistics.output_stage.query_stage_plan

Stage plan information such as name, identifier, sub plans, and source stages.

Show child fields
query_runtime_statistics.output_stage.query_stage_plan.identifier

Information about the operation this query stage plan node is performing.

query_runtime_statistics.output_stage.query_stage_plan.name

Name of the query stage plan that describes the operation this stage is performing as part of query execution.

query_runtime_statistics.output_stage.query_stage_plan.remote_sources[]
query_runtime_statistics.output_stage.stage_id

The identifier for a stage.

query_runtime_statistics.output_stage.state

State of the stage after query execution.

query_runtime_statistics.rows

Statistics such as input rows and bytes read by the query, rows and bytes output by the query, and the number of rows written by the query.

Show child fields
query_runtime_statistics.rows.input_bytes

The number of bytes read to execute the query.

query_runtime_statistics.rows.input_rows

The number of rows read to execute the query.

query_runtime_statistics.rows.output_bytes

The number of bytes returned by the query.

query_runtime_statistics.rows.output_rows

The number of rows returned by the query.

query_runtime_statistics.timeline

Timeline statistics such as query queue time, planning time, execution time, service processing time, and total execution time.

Show child fields
query_runtime_statistics.timeline.engine_execution_time_in_millis

The number of milliseconds that the query took to execute.

query_runtime_statistics.timeline.query_planning_time_in_millis

The number of milliseconds that Athena took to plan the query processing flow. This includes the time spent retrieving table partitions from the data source. Note that because the query engine performs the query planning, query planning time is a subset of engine processing time.

query_runtime_statistics.timeline.query_queue_time_in_millis

The number of milliseconds that the query was in your query queue waiting for resources. Note that if transient errors occur, Athena might automatically add the query back to the queue.

query_runtime_statistics.timeline.service_pre_processing_time_in_millis

The number of milliseconds that Athena spends on preprocessing before it submits the query to the engine.

query_runtime_statistics.timeline.service_processing_time_in_millis

The number of milliseconds that Athena took to finalize and publish the query results after the query engine finished running the query.

query_runtime_statistics.timeline.total_execution_time_in_millis

The number of milliseconds that Athena took to run the query.