> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tablepro.app/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 FTS5 full-text search

# Query History

Every query you execute is automatically saved to a local SQLite database. Search with full-text search, filter by connection or time range, and re-run past queries. History persists across sessions.

<Frame caption="Query history panel">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/query-history.png" alt="Query History" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/query-history-dark.png" alt="Query History" />
</Frame>

Click **View** > **Query History**, press `Cmd+Y`, or click the **History** icon in the toolbar. Recent queries also appear in the sidebar.

The history panel shows your executed queries with execution time, status, and database. Sort by time (most recent first), duration, or query text. Filter by connection, status (success/error), or time range (today, week, month, all time).

<Frame caption="History panel with filter controls">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-filters.png" alt="History panel with filter controls" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-filters-dark.png" alt="History panel with filter controls" />
</Frame>

## Searching History

### Full-Text Search

Type in the search box to find queries containing specific text:

```
SELECT users  -- Find all queries containing "SELECT" and "users"
```

<Frame caption="Searching query history">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-search.png" alt="History search" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-search-dark.png" alt="History search" />
</Frame>

## Using History

### Re-running Queries

Double-click a query to load it into the editor, then press `Cmd+Enter`. Or right-click > **Run Query**.

### Copying Queries

Select a query and press `Cmd+C`, or right-click > **Copy Query**.

<Frame caption="Query history context menu">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-context-menu.png" alt="Query history context menu" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-context-menu-dark.png" alt="Query history context menu" />
</Frame>

### Editing Before Running

Double-click to load into the editor, modify, and execute. The original history entry is preserved.

## Query Details

### Viewing Full Query

For long queries, click to expand and see the full text:

<Frame caption="Full query view">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-detail.png" alt="Query detail" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-detail-dark.png" alt="Query detail" />
</Frame>

Failed queries show the error message, the query that failed, and the timestamp. Load a failed query into the editor to fix and re-run.

<Frame caption="Failed query entry with error message">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-failed-query.png" alt="Failed query entry with error message" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/history-failed-query-dark.png" alt="Failed query entry with error message" />
</Frame>

## Storage

Query history is stored in `~/Library/Application Support/TablePro/query_history.db` (a local SQLite database with FTS5 full-text search).

Configure retention in **Settings** > **General**:

| Setting          | Default | Description                      |
| ---------------- | ------- | -------------------------------- |
| **Max Entries**  | 10,000  | Maximum queries to store         |
| **Max Days**     | 90      | Delete queries older than this   |
| **Auto Cleanup** | On      | Automatically remove old entries |

To clear all history, open **Settings** > **General** and click **Clear All History**. For a specific connection, right-click it in the sidebar and select **Clear History**.

## 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).
