Saved queries and query history
A query worth keeping goes in Saved Queries. Every query anyone runs is recorded in Query History, so nothing you ran last week is lost.
Saved queries
Save a query from SQL Lab with Save. The Saved Queries page in the sidebar lists them for everyone who can read them.
- Open in SQL Lab
- Open the query in a SQL Lab tab, on its connection, ready to run.
- Edit
- Change its name or SQL.
- Delete
- Remove it. You're asked to confirm.
- Verified Answers
- The page's second tab: questions paired with SQL known to answer them, which Insight AI follows. See Verified answers.
Query history
Query History records the queries run in the workspace, with where each came from, such as SQL Lab. Use it to rerun something, to see who ran what, or to find out why a query failed.
The summary
Along the top: how many queries ran in the last 24 hours, their average time, and the share that failed.
Each row
- Status
- Success, failed or running.
- SQL query preview
- The start of the query; open the row for all of it.
- User
- Who ran it.
- Database / schema
- The connection it ran on.
- Duration and rows
- How long it took and how many rows it returned.
- Executed at
- When it ran.
- SQL Lab
- Open the query in SQL Lab to run or change it.
- Copy SQL
- Copy the full query.
- Delete
- Remove a failed query from the history.
Find a query
- Status
- All, Success, Failed or Running.
- User
- Everyone, or one person.
- Timeframe
- Last 24 Hours, Last 7 Days, Last 30 Days or All Time.
- Export CSV
- Download the filtered list.
- New SQL Query
- Open an empty SQL Lab tab.
How long history is kept is a workspace setting: Query History Retention.
Who sees what
Reading saved queries and reading query history are permissions of their own, given per role in Members and roles. Opening a query in SQL Lab still needs access to its connection.