Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
18 KiB
Managing the History of Executed SQL Queries
Data Studio allows viewing and managing frequently executed SQL queries. The history of executed SQL queries is saved only in SQL Terminal.
Perform the following steps to view the history of executed SQL queries:
The number of queries displayed in the SQL History dialog box depends on the value set in Preferences > Editor > SQL History. For details about setting the value, see SQL History. Data Studio overwrites the older queries into the SQL history after the list is full. The executed queries are automatically stored in the list.
The SQL History dialog box contains the following columns:
- Pin Status: displays whether a query remains on the top. Pinned queries remain on the top and will not be deleted from the history even when the list is full.
- SQL Statement: displays the SQL query. The maximum number of characters for a SQL query displayed in the SQL Statement column depends on the value set in Preferences > Editor > SQL History. For details about modifying the value, see SQL History.
- Number of Records: displays the number of records obtained by the SQL query
- Start Time: displays the time when the query was executed
- Execution Time: displays the duration of the query execution
- Database Name: displays the name of the database
- Execution Status: displays the status of the executed query, which can be Success or Failure
The connection information is deleted together with the query history. If the SQL History dialog box is closed, the query is not removed from the list.
You can perform the following operations in the SQL History dialog box:
- Loading a SQL Query into the SQL Terminal Pane
- Loading Multiple SQL Queries into the SQL Terminal Pane
- Deleting a SQL Query
- Deleting All SQL Queries
- Pinning a SQL Query
- Unpinning a SQL Query
Loading a SQL Query into the SQL Terminal Pane
Perform the following steps to load a SQL query into the SQL Terminal pane:
Loading Multiple SQL Queries into the SQL Terminal Pane
You can click the Load in SQL Terminal and close History button to load selected queries into SQL Terminal and close the SQL History dialog box.
Perform the following steps to load multiple selected SQL queries into the SQL Terminal pane:

If you continue the execution upon an error, each statement in SQL Terminal will be executed in sequence as a scheduled job. The execution status is updated in the console and each job is listed in the progress bar. When the time difference between Job Execution, Progress Bar Update and Console Update is small, you will not be able to stop the execution by opening the progress bar. In this case, you need to close SQL Terminal to stop the execution.
Loading More Records
To load more data in the Result tab, you need to scroll down to bottom, which is inconvenient in some scenarios. Data Studio provides a button that simplifies the loading operation.
Perform the following steps to load more records:
Deleting All SQL Queries
Perform the following steps to delete all SQL queries from the SQL History list:
Pinning a SQL Query
You can pin queries that you do not want Data Studio to delete automatically from SQL History. You can pin a maximum of 50 queries. Pinned queries are displayed at the top of the list. The value set in SQL History does not affect the pinned queries. For details, see SQL History.

The pinned queries are displayed at the top of the list once the SQL History pane is closed and opened again.
Perform the following steps to pin a SQL query: