> ## 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 Tabs

> Each tab keeps its own SQL, results, sorting, and filters, and comes back after a restart

# Query Tabs

Every tab is a native macOS window tab: each tab is an NSWindow in a tab group, managed by the system tabbing API. Standard macOS tab behavior applies. Drag tabs to reorder or move them between windows, use **Window > Merge All Windows** and **Window > Move Tab to New Window**, press `Ctrl+Tab` to cycle, and use **View > Show All Tabs** (`Cmd+Shift+\`) for the tab overview. When more tabs open than fit, the tab bar shrinks them to fit, as in Safari.

Each tab is an independent workspace with its own SQL, results, sorting, and filter state. Tabs persist across app restarts.

<Frame caption="Tab bar with query and table tabs">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/tabs.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=3501aa66b3a1e74db8cfb4ee401f05ff" alt="Native tab bar with query and table tabs" width="1560" height="960" data-path="images/tabs.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/tabs-dark.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=edda61523ed2d616c2dce707376c48af" alt="Native tab bar with query and table tabs" width="1560" height="960" data-path="images/tabs-dark.png" />
</Frame>

## Tab Types

| Type          | Purpose                                                                        |
| ------------- | ------------------------------------------------------------------------------ |
| **Query tab** | Write and run SQL                                                              |
| **Table tab** | Browse table data with pagination, sorting, and [filters](/features/filtering) |

Table tabs track cell edits as pending changes by default. Query tabs support [change tracking](/features/change-tracking) only for simple `SELECT * FROM table` results.

## Preview Tabs

Single-clicking a table opens a preview tab that is reused when you click a different table, like VS Code's preview tabs. A tab with unsaved edits, an applied filter, or sorting is never replaced: the click opens a new tab instead. A preview tab becomes permanent when you double-click the table in the sidebar or interact with the tab (sort, filter, edit data). A preview tab still open at quit is restored as a permanent tab.

Turn preview tabs off with **Settings > General > Tabs > Enable preview tabs** if you prefer every click to open a permanent tab.

## Managing Tabs

### Creating and Closing

| Action           | How                                                                          |
| ---------------- | ---------------------------------------------------------------------------- |
| New query tab    | `Cmd+T` or the **+** button in the tab bar                                   |
| New table tab    | Double-click a table in the sidebar (single-click reuses the preview tab)    |
| Close tab        | `Cmd+W` or the tab's close button                                            |
| Close other tabs | Right-click the tab (native macOS menu, also has **Move Tab to New Window**) |

Closing a query tab keeps its SQL in Recently Closed, so an accidental close costs nothing. TablePro asks before closing only when unsaved work would be lost, such as pending data edits, pending structure changes, or unsaved edits to a `.sql` file on disk.

<Note>
  Window tabs cannot be pinned. Pinning exists for result tabs inside a query tab (`Cmd+Option+P`, see [Keyboard Shortcuts](/features/keyboard-shortcuts)).
</Note>

### Reopening Closed Tabs

| Action                     | How                                           |
| -------------------------- | --------------------------------------------- |
| Reopen the last closed tab | `Cmd+Shift+T` or **File > Reopen Closed Tab** |
| Reopen an older tab        | **File > Recently Closed**                    |

The last 20 closed query and table tabs are kept for 30 days. A reopened tab comes back with its SQL, cursor position, and database context. Deleting a connection also deletes its closed tabs.

### Switching Tabs

* `Cmd+1` through `Cmd+9` jump to a tab by position
* `Cmd+Shift+[` / `Cmd+Shift+]` for previous and next tab (`Ctrl+Tab` also works)

Each tab keeps its full state when you switch away: SQL, cursor position, results, scroll position, sort and filter state, and pending changes.

## Windows and Connections

Each connection opens its own window by default. Turn on **Settings > General > Tabs > Group all connections in one window** to keep tabs from different connections in a single window instead. New windows open at 1200x800; size and position are remembered across launches.

## Tab Persistence

| Saved                                      | Not saved                            |
| ------------------------------------------ | ------------------------------------ |
| SQL and cursor position                    | Query results (re-queried on reopen) |
| Tab type, table name, database, and schema | Pending data changes                 |
| Applied sort and current page              | Selected rows                        |
| Column widths                              |                                      |
| Window and tab order                       |                                      |

Per-table filters are stored separately per connection, database, schema, and table, and come back when the table reopens.

Tab state saves when you switch tabs and every 30 seconds in the background, so a crash or force quit keeps recent work. On relaunch, only the frontmost tab loads its data right away; other restored tabs load the first time you switch to them, so launch stays fast and the database never sees a connection storm. If a restored tab fails to load, the error shows inline in that tab, not as a dialog.

Whether the last session reopens at launch is controlled by [Startup Behavior](/customization/settings#general).

## Pagination

Table tabs load one page at a time. The default page size is 1,000 rows, set in **Settings > Data > Pagination** (100, 500, 1,000, 5,000, or 10,000 rows). Query tabs are not paginated: **Truncate query results** (on by default) caps results at 10,000 rows, and queries with their own `LIMIT` are sent as written. Adjust the cap in the same settings pane. See [Data Grid](/features/data-grid#pagination-and-limits) for the pagination controls.

## From External Clients

Raycast, Cursor, Claude Desktop, and other MCP clients can list and focus tabs across windows:

* `list_recent_tabs` enumerates open tabs across every window.
* `focus_query_tab` brings an existing tab to the front by id.
* `open_connection_window` opens a saved connection.
* `open_table_tab` opens a specific table.

The Raycast extension's [Recent Tabs command](/external-api/raycast#commands) wraps these tools. See [MCP Tools](/external-api/mcp-tools) for input and output schemas.
