SQL Query History

Last modified: March 28, 2025

The Query History document can be used to keep track of all the queries that have been executed within the SQL document. It allows users to view, search for executed queries, edit, filter, and export them to a .csv file.

Open the Query History document

To open the Query History document, use one of the following ways:

  • On the SQL toolbar, select Show Query History.

    Note

    If the SQL toolbar is turned off, you can turn it on by navigating to the View menu and selecting Toolbars > SQL.

  • On the ribbon, select View > Other Windows > Query History.
  • Press Ctrl+Alt+H.

Hovering over the row in the Query Text column displays the text of the executed query.

Query History

The Query History document is organized into two main sections:

  • Query History document: A tabular representation of the query history.
  • Preview pane: An area to view detailed query information.

The Query History document includes the following columns:

  • Status: The success or failure of the query execution.
  • Query Text: The text of a SQL query that was executed.
  • Size (Bytes): The memory footprint of the query.
  • Executed On: The exact time and date the query was run.
  • Duration: The time it took for the query to execute.
  • File: The name of the file containing the SQL statement.
  • Server: The server on which the query was executed.
  • User: The user who executed the query.

Set up the Query History behavior

You can configure the Query History behavior in the Options dialog. To open it, use one of the following ways:

  • On the ribbon, select Tools > Options.
  • In the upper-right corner of the Query History document, select and then select Options.

In the Options dialog, navigate to Environment > Documents > Query History to set up the Query History settings:

  • Select Store query history to enable the storage of the query history. The option is selected by default.
  • Modify the storage path for the Query History database and set the maximum script size to store.
  • Automatically remove queries older than the specified period.

By default, the query history is saved in the following folder:
C:\Users\Username\AppData\Roaming\Devart\dbForge Studio for Oracle\ExecutedQueries
where Username is the name of the current user.

The maximum script size is set to 1024 KB by default. Executed queries are stored for 60 days by default, while the maximum interval that can be set is 365 days. After the specified period has ended, the history is automatically deleted. You can also back up your history data by copying the file from the storage folder to another location on your computer.

Note

Once the data has been automatically deleted, the history files can no longer be reopened in the dbForge tool.

To save the changes, select OK.

Query History Options

Filter query history

The tool allows you to filter queries using the search box or by applying filters available for each column in the Query History document.

In the Search box, type the search string to find specific queries. The text matching the search criterion will be highlighted in green. To delete the text in the Search box, select Clear Filter icon Clear Filter in the Search box.

Query Search

Filter queries per column

To filter queries per column, hover over the upper-right corner of the column header and select the filter icon:

SQL Query History column filters

Status

Select the checkbox next to the query status you want to display in the Query History document.

Query History column filters

Query Text

Select the checkboxes next to the queries on the Values tab or choose the condition from the list and specify the value on the Text Filters tab.

SQL Query History column filters

Size (in bytes)

Select the minimum and maximum values to filter the entries using the slider on the Values tab or choose the condition from the list and specify the value on the Numeric Filters tab.

SQL Query History column filters

Executed On

Select the checkboxes next to the date range from the list on the Values tab or select the checkboxes next to the filter on the Date Filters tab.

SQL Query History column filters

Duration

Select the checkboxes next to the query duration from the list on the Values tab or choose the condition from the list and specify the value on the Filters tab.

SQL Query History column filters - Duration

File

Select the checkboxes next to the file on the Values tab or choose the condition from the list and specify the value on the Text Filters tab.

SQL Query History column filters - File

Server

Select the checkboxes next to the servers from the list on the Values tab or choose the condition from the list and specify the value on the Text Filters tab.

SQL Query History column filters - Server

User

Select the checkboxes next to the user from the list on the Values tab or choose the condition from the list and specify the value on the Text Filters tab.

SQL Query History column filters - User

Filter queries by time period

From the Period list, select the required timeframe to filter queries by their execution period. To specify a custom timeframe, select Custom Range from the list.

In the Custom Range dialog that opens, set the time period and select OK.

Filter by custom period

Manage filters

The Studio allows you to add, edit, or delete filters using the Filter panel or the Filter Editor dialog.

Use the Filter panel

The Filter panel allows you to:

  • View the applied filters.
  • Clear the checkbox to delete the filter.
  • Select the Delete icon delete icon to remove the filter.

Filter panel

Use the Filter Editor dialog

To open the Filter Editor dialog, select Edit Filter in the Filter panel.

Filter panel

The Filter Editor dialog allows you to:

  • Add or remove a filter condition.
  • Choose a relation type and enter a value to set up a filter condition.

Choose a relation type

  • Choose a logical operator. To change a group logical operator, click it and select another one from the menu.

Choose a logical operator

  • Add a condition or a group united with a logical operator. Then, choose a database, a relation type, and a value by which the queries will be filtered.

Add a condition or a group

To apply the filter, select Apply. This keeps the dialog open, and you can edit the filter. To save the changes and close the dialog, select OK. To discard the changes, select Cancel.

Use shortcut options

Right-clicking the column header will call the shortcut menu with the following options:

  • Sort Ascending: Apply ascending sort order to the column.
  • Sort Descending: Apply descending sort order to the column.
  • Clear Sorting: Remove sorting for the selected column.
  • Clear All Sorting: Reset sorting to default.
  • Group By This Column: Group queries by the selected column.
  • Show/Hide Group By Box: Show\Hide the Group By Box pane.
  • Hide This Column: Hide the selected column.
  • Column Chooser: Open the Customization window to remove the columns from the Query History grid or add them back.
  • Best Fit: Ditto for the selected column.
  • Best Fit (all columns): Ditto for all columns.
  • Filter Editor: Open the editor with filtering options.
  • Show/Hide Auto Filter Row: Show or hide a row to filter data directly from the grid.

Query History - shortcut menu

Note

Query History is stored in the ExecutedQueries.db file. To specify a path to the folder where this file will be stored, go to Tools menu > Options > Environment > Documents > Query History. The default path is %appdata%\Devart\dbForge Studio for Oracle\ExecutedQueries.

Note that this file does not store your connection passwords.

Group executed queries by column

To group executed queries by column, right-click the column header by which you want to group queries and select Group By This Column. The data will be automatically displayed in groups, each represented by a collapsed node. The column header will be moved to the Group by Box pane.

Group By this Column - Result

Alternatively, right-click the column header and select Show Group by Box. The Group by Box pane will appear above the grid. Drag a column header you want the data to be grouped by to the pane.

Group By this Column - Result #2

You can group data by multiple columns. In this case, the grid will display a tree of nested groups that you can expand or collapse by clicking the corresponding arrows.

Group By this Column - Nested Tree

You can also sort the grouped data as follows:

  • Select a sort glyph on the column header.
  • Right-click the column header and select Sort Ascending or Sort Descending.

To manage the grouped data, right-click the Group By Box pane and select the required option from the shortcut menu:

  • Full Expand: Display all nested elements.
  • Full Collapse: Hide all nested elements.
  • Clear Grouping: Remove all applied groupings from the Group by Box pane.
  • Hide Group By Box: Hide the Group By Box pane.

Group By this Column - Shortcut menu

Use the Customization window

The Customization window displays the column headers from the Query History grid. The window allows you to remove, sort, or manage the columns.

Remove columns from the Query History grid

1. On the Query History grid, right-click the column header and select Column Chooser to open the Customization window.

Customization window

2. In the window, all the columns are selected by default. Clear the checkboxes next to the columns you want to remove from the grid.

Manage columns using options from the shortcut menu

Right-clicking the column will invoke the shortcut menu to manage columns on the grid.

Customization window - shortcut menu

Sort queries by column

The sort glyph indicates the current sort order of a column. If the column is not sorted, the sort glyph is hidden. To remove sorting, select Clear Sorting.

Customization window - sort by column

Show/Hide Auto Filter Row

Right-click the column header and select Show Auto Filter Row.

Show Auto Filter Row

Manage the query text from the Preview pane

Navigate to the lower Preview pane that displays the text of the selected query.

To use the shortcut options, right-click anywhere in the Preview pane and select the required option.

Preview pane

Edit a query

The query can be edited as follows:

Way 1 - double-click the required query:

Double-click the required query in the Query History document. This will open the query in a new SQL document where you can edit and execute it.

Edit a Query

Way 2 - use the “To New SQL Window” option:

1. Select the required query and then right-click it.

2. From the shortcut menu, select To New SQL Window. The query will open in a new SQL document.

To New SQL Window

Export query history to a .csv file

1. On the toolbar of the Query History document, select Export to CSV.

Export query history to a .csv file

2. In the Save As window that opens, select the folder to store the file and specify the file name.

3. Select Save to save the changes.

To open the file, navigate to the folder containing the file and double-click it. The .csv file will display query history:

Result - .csv file with query history

Clear the query history

1. On the Query History document, select Clear or press Ctrl+Del.

2. A message appears notifying you that all records in the query history will be deleted.

3. Select Yes to confirm the deletion or select No to cancel it.

Clear Query History

Reset view layout

To reset view layout, in the upper-right corner of the Query History document, select and then select Reset View Layout.