- 08 Aug 2023
- 2 Minutes to read
- Updated on 08 Aug 2023
- 2 Minutes to read
All queries that have been run in SQL Editor will appear in the Query History screen.
From there, you have access to a variety of features that enable you to manage and work with historical queries, such as:
- Filter and search queries
- View at-a-glance query details, such as time executed, database, schema, tables, user, rows, and schema code
- Launch any historical query in the SQL Editor
Let's look at historical queries in more detail below.
Navigate to Query History
In the Toolbar, select SQL Lab and, in the drop-down menu, select Query History.
|Time||The date & time stamp when the SQL query was executed.|
|Tab name||The name of the SQL query's tab, if defined.|
|Database||The database associated with the query.|
|Schema||The schema associated with the query.|
|Tables||The table(s) associated with the query.|
|User||The Preset user who created and launched the query.|
|Rows||The number of rows produced from the run query.|
|SQL||The initial lines of the query's underlying SQL code — select to view the full query.|
|Actions||Select to launch the query in the SQL Editor.|
Query Search and Filters
There are a number of filters, as well as a keyword search feature, available along the horizontal bar above the content panel.
- Database: This field will be populated by all databases used in the list of queries. Simply select a database to filter by queries that are associated with your selection.
- State: Filter by all queries, succesful queries, or failed queries.
- User: Filter by the user who created a query.
- Time range: Define a starting & ending date & time range and queries that ran within that span will be displayed.
- Search: Enter a search term, select the magnifying glass icon, and queries that meet your search criteria will appear.
View SQL Code
To view the underlying SQL code for a query, select the text field under the SQL column header:
The Query preview panel appears.
This panel displays the underlying SQL code for the query. By default, the query as defined by the user (User query tab) is displayed — to view the executed query, select the Executed query tab.
To copy the SQL code to your system's clipboard, hover your cursor over the code and then select the copy icon.
To scroll through query search results, select Previous or Next as needed.
To view the currently displayed SQL query in the SQL Editor, select Open in SQL Lab.