> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-feat-ai-sql-walkthroughs.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

# Query History

Every query you run is saved automatically, whether it succeeded or failed. History persists across sessions and is searchable with full-text search.

Open the panel with `Cmd+Y`, **View** > **Toggle History**, or the **History** button in the toolbar.

<Frame caption="Query history panel: entry list on the left, preview on the right">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/query-history.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=1f99877b1a6d75ec4a999cd17e2718d0" alt="Query history panel" width="1560" height="960" data-path="images/query-history.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/query-history-dark.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=8dd635c73908656f8f7597ae1dbe838f" alt="Query history panel" width="1560" height="960" data-path="images/query-history-dark.png" />
</Frame>

## The Panel

The left pane lists entries, newest first. Each row shows a green checkmark or red error icon, the query text, the database, when it ran, and how long it took. The right pane shows the selected query with syntax highlighting, plus its database, execution time, row count, timestamp, and the error message for failed queries.

Narrow the list with the date picker (Today, This Week, This Month, All Time) or type in the search field for full-text search across query text. The date filter persists across sessions. The list shows the 500 most recent matches.

Recent queries also appear in the [Quick Switcher](/features/quick-switcher).

## Working With Entries

| Action               | How                                                                       |
| -------------------- | ------------------------------------------------------------------------- |
| Load into the editor | Select an entry, then click **Load in Editor** or press `Return`          |
| Run again            | Right-click > **Run in New Tab**                                          |
| Copy the query       | `Cmd+C`, the **Copy Query** button, or right-click > **Copy Query**       |
| Save as favorite     | Right-click > **Save as Favorite** (see [Favorites](/features/favorites)) |
| Delete one entry     | `Delete` key or right-click > **Delete**                                  |
| Clear all entries    | Trash button in the panel header, then confirm                            |

Loading a query into the editor lets you edit it before running. The original history entry stays unchanged.

## Storage and Retention

History lives in `~/Library/Application Support/TablePro/query_history.db`, a local SQLite database with an FTS5 full-text index.

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 startup | On      | Removes entries past the limits at launch |

The **Clear History...** button in the same section deletes all entries after a confirmation. There is no per-connection clear.

## Search From External Clients

History is searchable from MCP clients. The `search_query_history` tool returns matching entries with timestamp, connection, query text, and outcome. The Raycast extension wraps this in a **Search Query History** command.

See [`search_query_history`](/external-api/mcp-tools) and [Raycast commands](/external-api/raycast#commands).
