> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-docs-fix-500-query-results.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query History

> Every executed query is saved to a local SQLite database with full-text search

By default the drawer shows only the SQL you wrote yourself. The SELECTs behind table browsing, the UPDATEs behind grid edits, the DDL behind a structure change and everything an MCP client ran are all recorded too, waiting behind the **Source** menu.

Open the drawer with `Cmd+Y` or **View > Show Query History**. There is also a **History** toolbar button, added through **View > Customize Toolbar…**.

<Frame caption="Query history drawer: entry list on the left, details on the right">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/HJY892UtvXUv1PFn/images/query-history.png?fit=max&auto=format&n=HJY892UtvXUv1PFn&q=85&s=a9a07d48c69495311b7b001d46c7cc56" alt="Query history drawer" width="1560" height="960" data-path="images/query-history.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/HJY892UtvXUv1PFn/images/query-history-dark.png?fit=max&auto=format&n=HJY892UtvXUv1PFn&q=85&s=1cfdc4d8fe876f31d80d2011945e2542" alt="Query history drawer" width="1560" height="960" data-path="images/query-history-dark.png" />
</Frame>

## The drawer

The drawer opens under the editor and its divider resizes it. Height, filters and whether it was open are remembered per connection.

Entries group by day, newest first, under **Today**, **Yesterday**, or the date. A row carries the outcome, the query text, the database, the time it ran and how long it took. Under a millisecond reads `<1 ms`; a step whose duration was never measured reads `–` rather than `0 ms`.

Select a row and the right pane shows the full query, highlighted for the database it ran against, with its connection, database and schema, timestamp, duration, row count, source, and the error when it failed. The keyboard stays in the list, so arrow keys keep moving.

Recent queries also appear in [Open Quickly](/features/open-quickly). For the summary rather than the list, see [Query Insights](/features/query-insights).

## Filtering

| Control | What it does                                             |
| ------- | -------------------------------------------------------- |
| Scope   | This connection, or all connections                      |
| Source  | Which parts of the app a query came from                 |
| Date    | Last hour, today, last 7 days, last 4 weeks, all time    |
| Outcome | Any, succeeded, or failed                                |
| Search  | Full-text search across query text, matching as you type |

Search matches partial words, so `cust` finds `customers`. Several words must all match but need not be adjacent: `select customers` finds `SELECT id, name FROM customers`.

**All Connections** searches everything you have, and rows then name their connection, so two databases both called `app` stay apart. **Reset Filters** puts the drawer back to its defaults.

### Sources

| Source            | What it covers                                                             |
| ----------------- | -------------------------------------------------------------------------- |
| Editor            | Queries you ran from a query tab                                           |
| Explain           | EXPLAIN runs                                                               |
| Table Browsing    | The SELECTs the app generates when you open a table, page, sort, or filter |
| Row Edits         | The INSERT, UPDATE and DELETE statements produced by saving grid edits     |
| Structure Changes | DDL from the structure editor, triggers, and user management               |
| Imports           | Import runs                                                                |
| AI and MCP        | Queries run by an AI assistant or an MCP client                            |

**My Queries**, the default, is Editor and Explain. Add **Table Browsing** to see what the app sent while you clicked around a table, **Structure Changes** to review what altered a schema and when.

## Working with entries

| Action               | How                                                                        |
| -------------------- | -------------------------------------------------------------------------- |
| Load into the editor | `Return`, double-click the row, or click **Load in Editor**                |
| Run it again         | **Run in New Tab**, or right-click > **Run in New Tab**                    |
| Copy the query       | `Cmd+C`, the **Copy** button, or right-click > **Copy Query**              |
| Save as favorite     | Right-click > **Save as Favorite…** (see [Favorites](/features/favorites)) |
| Delete one entry     | `Delete`, or right-click > **Delete**                                      |
| Load older entries   | **Load More** at the bottom of the list                                    |

**Run in New Tab** goes to the server, so an entry that writes asks for confirmation whatever the connection's [safe mode](/features/safe-mode) is set to. Reads run straight away, and an entry using [query parameters](/features/query-parameters) raises the parameter panel instead.

An entry belonging to another connection loads into a new tab in that connection's own window rather than running against the connection in front of you. **Run in New Tab** is dimmed for those entries: load it there and run it from that window.

## Pausing

The pause button stops recording on this Mac, from every source: row edits, structure changes, imports and AI clients included. The drawer says so until you resume. Pausing is local to the Mac you press it on and survives relaunch.

## Clearing history

The trash button deletes exactly the entries the drawer is listing. Anything the source, date, outcome or search filters are hiding stays, which at the default **My Queries** source spares table browsing, row edits, imports and AI queries. The confirmation names what it is about to delete. There is no undo.

**Settings > Data > Query History > Clear History…** clears everything, for every connection.

## Storage and retention

History lives in `~/Library/Application Support/TablePro/query_history.db`, a local SQLite database with a full-text index. It never leaves the Mac that recorded it: query history is not one of the categories [iCloud sync](/features/icloud-sync) carries, so two Macs keep two separate histories.

There is no export command. The file is an ordinary SQLite database, so open it as a SQLite connection and query it like anything else.

Configure retention in **Settings > Data > Query History**:

| Setting          | Default | Options                                                                        |
| ---------------- | ------- | ------------------------------------------------------------------------------ |
| Maximum entries  | 10,000  | 100 to 10,000, or Unlimited                                                    |
| Keep entries for | 90 days | 7 days to 1 year, or Forever                                                   |
| Auto cleanup     | On      | Enforces the entry count and the age limit. Turn it off and nothing is pruned. |

Deleting a connection deletes its query history with it.

Parameter values are never recorded here, and the user and role editor never records a statement carrying a password, such as `CREATE USER … IDENTIFIED BY`. A query you wrote yourself is recorded as you wrote it, so pause before running one that contains a secret.

## Search from external clients

The [`search_query_history`](/external-api/mcp-tools) MCP tool returns matching entries with timestamp, connection, query text, source and outcome. The Raycast extension wraps it in a **Search Query History** command; see [Raycast commands](/external-api/raycast#commands).
