Athena / Client / get_query_runtime_statistics

get_query_runtime_statistics#

Athena.Client.get_query_runtime_statistics(**kwargs)#

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. Query execution runtime statistics are returned only when QueryExecutionStatus$State is in a SUCCEEDED or FAILED state. Stage-level input and output row count and data size statistics are not shown when a query has row-level filters defined in Lake Formation.

See also: AWS API Documentation

Request Syntax

response = client.get_query_runtime_statistics(
    QueryExecutionId='string'
)
Parameters:

QueryExecutionId (string) –

[REQUIRED]

The unique ID of the query execution.

Return type:

dict

Returns:

Response Syntax

{
    'QueryRuntimeStatistics': {
        'Timeline': {
            'QueryQueueTimeInMillis': 123,
            'ServicePreProcessingTimeInMillis': 123,
            'QueryPlanningTimeInMillis': 123,
            'EngineExecutionTimeInMillis': 123,
            'ServiceProcessingTimeInMillis': 123,
            'TotalExecutionTimeInMillis': 123
        },
        'Rows': {
            'InputRows': 123,
            'InputBytes': 123,
            'OutputBytes': 123,
            'OutputRows': 123
        },
        'OutputStage': {
            'StageId': 123,
            'State': 'string',
            'OutputBytes': 123,
            'OutputRows': 123,
            'InputBytes': 123,
            'InputRows': 123,
            'ExecutionTime': 123,
            'QueryStagePlan': {
                'Name': 'string',
                'Identifier': 'string',
                'Children': [
                    {'... recursive ...'},
                ],
                'RemoteSources': [
                    'string',
                ]
            },
            'SubStages': [
                {'... recursive ...'},
            ]
        }
    }
}

Response Structure

  • (dict) –

    • QueryRuntimeStatistics (dict) –

      Runtime statistics about the query execution.

      • Timeline (dict) –

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

        • QueryQueueTimeInMillis (integer) –

          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.

        • ServicePreProcessingTimeInMillis (integer) –

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

        • QueryPlanningTimeInMillis (integer) –

          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.

        • EngineExecutionTimeInMillis (integer) –

          The number of milliseconds that the query took to execute.

        • ServiceProcessingTimeInMillis (integer) –

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

        • TotalExecutionTimeInMillis (integer) –

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

      • Rows (dict) –

        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.

        • InputRows (integer) –

          The number of rows read to execute the query.

        • InputBytes (integer) –

          The number of bytes read to execute the query.

        • OutputBytes (integer) –

          The number of bytes returned by the query.

        • OutputRows (integer) –

          The number of rows returned by the query.

      • OutputStage (dict) –

        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.

        • StageId (integer) –

          The identifier for a stage.

        • State (string) –

          State of the stage after query execution.

        • OutputBytes (integer) –

          The number of bytes output from the stage after execution.

        • OutputRows (integer) –

          The number of rows output from the stage after execution.

        • InputBytes (integer) –

          The number of bytes input into the stage for execution.

        • InputRows (integer) –

          The number of rows input into the stage for execution.

        • ExecutionTime (integer) –

          Time taken to execute this stage.

        • QueryStagePlan (dict) –

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

          • Name (string) –

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

          • Identifier (string) –

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

          • Children (list) –

            Stage plan information such as name, identifier, sub plans, and remote sources of child plan nodes/

            • (dict) –

              Stage plan information such as name, identifier, sub plans, and remote sources.

          • RemoteSources (list) –

            Source plan node IDs.

            • (string) –

        • SubStages (list) –

          List of sub query stages that form this stage execution plan.

          • (dict) –

            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.

Exceptions

  • Athena.Client.exceptions.InternalServerException

  • Athena.Client.exceptions.InvalidRequestException