Skip to content

Query History

The Query History page displays the list of queries that were run while the Presto engine was running. It includes SQL that was run by a user along with SQL that was run by the watsonx.data UI to populate the values in the dialog.

Click on the Query History icon on the left side of the screen
icon

Browser

The Query History dialog provides a list of all SQL statements sorted by creation time.

You may need to refresh the browser screen to see an updated list of queries

Browser

The table contains the following columns:

  • Query ID - The unique query ID assigned to the SQL statement
  • Query - The SQL text that was executed
  • State - What the statement is currently doing (Finished, Running)
  • Engine - What engine the query was executed on
  • User - The user that submitted the query
  • Source - Where the query was initiated from
  • Created - Creation date and time of the query

There are two additional columns which are not displayed:

  • Queued time - The amount of time the query waited to execute
  • Analysis time - The amount of time it took to optimize the query

The columns that are displayed can be adjusted by using the customize option at the top of the query list.

Browser

Remove Engine and Source and Add Queued and Analysis Time

Browser

You can further refine the list by clicking on individual columns to sort in ascending or descending order.

Browser

Sort the results by Analysis time

Browser

Additional filters are available by pressing the filter button above the query list.

Browser

Filter by the Source being the System

Browser

If you find a query that you want to see more details on, click on the kebab symbol at the end of the line

Browser

You have the choice of viewing the execution plan of the query, or placing the query into the Query workspace. This provides a simple of way of retrieving SQL that you may have deleted from your Query workspace!

The execution plan may be useful to debug performance issues with a query.

Clear the filters (found at the top of the query list) and sort by Query ID

Browser

Your screens will be different that the ones found in the lab

Find the first SQL statement in your list of queries and select the View Execution Plan option

Browser

The panel displayed will be similar to the following.

Browser

Select the Query Statement tab

The SQL statement that was executed is found here. It may be a system routine if you did not filter the queries by userid.

Browser

Select the Logical Execution Details tab

This panel provides the logical steps that the engine goes through to compute the answer set.

Browser

Select the Distributed Execution Details

This panel provides information how the query is distributed among engines.

Browser

Select the Explain Analysis

This panel provides details on the explain analysis (costs) of the various steps in executing the query.

Browser

Summary

In this lab you learned how to look at previous queries, examine the SQL that was executed, and view the explain plans that were generated by the Presto engine.