Skip to main content

Query Tabs

TablePro uses a tabbed interface for working with multiple queries and tables simultaneously. Each tab maintains its own SQL content, results, pagination, sorting, and filter state, so you can switch between tasks without losing context.
Query Tabs

Overview

Tabs are the primary workspace in TablePro. When you connect to a database, you can open as many tabs as you need. Tabs persist across app restarts, and each connection remembers its own set of tabs.

Tab Types

TablePro supports three types of tabs, each designed for a different workflow:
TypeIconPurpose
Query TabDocument iconWrite and execute custom SQL queries
Table TabTable icon (blue)Browse table data with pagination and filtering
Create Table TabSpecialDesign and create new tables visually

Query Tabs

Query tabs are general-purpose SQL editors. Use them for:
  • Writing and running ad-hoc queries
  • Exploring data with custom SELECT statements
  • Running DDL or DML operations
  • Testing queries before adding them to your application
Query tabs start with an empty editor. Type your SQL and press Cmd+Enter to execute.

Table Tabs

Table tabs are opened when you click a table name in the sidebar. They provide:
  • Automatic SELECT * FROM table LIMIT n query generation
  • Server-side pagination with page navigation controls
  • Inline editing with change tracking
  • Structure view toggle for viewing/modifying table schema
  • Filter support for narrowing results
Table tabs are editable by default. Query tabs are read-only unless the query is a simple SELECT * FROM table statement.

Smart Tab Reuse

When you click a table in the sidebar, TablePro uses smart tab management (similar to TablePlus):
  • Same table: Switches to the existing tab (no new query executed)
  • Different table, clean tab: Replaces the current table tab if it has no unsaved changes and no user interaction
  • Different table, dirty tab: Opens a new tab to preserve your work
This keeps the tab bar clean while protecting your changes.

Managing Tabs

Creating Tabs

ActionHow
New query tabClick the + button in the tab bar, or press Cmd+T
New query tab (from toolbar)Click the SQL button in the toolbar
New table tabClick a table name in the sidebar
New table tab (with query)Open a query tab, then use the SQL editor

Closing Tabs

ActionHow
Close current tabPress Cmd+W
Close specific tabHover over the tab and click the x button
Close from context menuRight-click the tab and select Close Tab
Close other tabsRight-click a tab and select Close Other Tabs
Closing a tab with unsaved changes will discard those changes. TablePro will warn you before closing if there are pending data modifications.

Switching Tabs

Click any tab in the tab bar to switch to it, or use keyboard shortcuts:
  • Cmd+1 through Cmd+9 to jump to a tab by position
  • Cmd+Shift+[ or Cmd+Option+Left for the previous tab
  • Cmd+Shift+] or Cmd+Option+Right for the next tab
The previous tab’s state is fully preserved, including:
  • SQL editor content and cursor position
  • Query results
  • Scroll position in the data grid
  • Selected rows
  • Sort and filter state
  • Pending changes

Reordering Tabs

Drag any tab to a new position in the tab bar to reorder it. A blue insertion indicator shows where the tab will be placed when you drop it. The tab bar scrolls horizontally when there are more tabs than can fit in the available space. The selected tab is automatically scrolled into view.

Pinning Tabs

Pin important tabs to prevent accidental closure:
  1. Right-click the tab
  2. Select Pin Tab
  3. A pin icon appears on the tab
Pinned tabs:
  • Cannot be closed via the close button, Cmd+W, or the context menu
  • Are not closed when you select Close Other Tabs
  • Are not replaced when clicking a different table in the sidebar
  • Remain open across sessions
To unpin, right-click and select Unpin Tab.

Duplicating Tabs

To create a copy of an existing tab:
  1. Right-click the tab
  2. Select Duplicate Tab
  3. A new tab opens with the same query content and results
The duplicated tab is inserted immediately after the original.

Tab State

Each tab stores a comprehensive set of state that is preserved when switching between tabs.

State Properties

PropertyDescription
Tab IDUnique identifier (UUID)
TitleDisplay name shown in the tab bar
SQL ContentThe query text in the SQL editor
Tab TypeQuery, table, or create table
Table NameAssociated table name (for table tabs)
Result ColumnsColumn names from the last query
Result RowsRow data from the last query (cached)
Column TypesData type metadata for formatting
Execution TimeDuration of the last query
Error MessageError from the last failed query
Is EditableWhether inline editing is enabled
Pagination StateCurrent page, page size, total rows
Sort StateSort column and direction
Filter StateActive filters and visibility
Pending ChangesQueued data modifications
Selected RowsCurrently selected row indices
Result VersionCache invalidation counter

Per-Tab Change Tracking

Each tab maintains its own pending changes. When you switch to a different tab:
  1. The current tab’s changes are saved to the tab’s pendingChanges property
  2. The change manager loads the new tab’s pending changes
  3. Visual indicators update to reflect the new tab’s state
This means you can have pending edits in multiple tabs simultaneously without interference.

Tab Persistence

Tabs persist across app restarts so you can pick up exactly where you left off.

What Is Persisted

SavedNot Saved
Tab ID and titleQuery results (re-queried on reopen)
SQL contentPending data changes
Tab typeSelected rows
Table nameSort and filter state
Pin stateExecution time

How Persistence Works

1

Debounced Auto-Save

Tab state is automatically saved 500ms after any change (debounced to avoid rapid successive writes)
2

Per-Connection Storage

Each database connection has its own saved tab state, stored in UserDefaults with a connection-specific key
3

Restoration on Connect

When you reconnect to a database, TablePro restores the saved tabs and re-executes queries for table tabs
4

Window Close Handling

When you close a window, any pending debounced save is flushed immediately to prevent data loss

Last Query Memory

TablePro also remembers the last query text for each connection, similar to TablePlus. Even if you close all tabs, the last query is preserved and can be restored when you create a new tab.

Pagination in Tabs

TablePro uses different pagination strategies depending on the tab type.

Table Tabs (Server-Side Pagination)

Table tabs use SQL LIMIT and OFFSET for pagination:
  • Only the current page of data is loaded from the database
  • Page navigation triggers a new query
  • Default page size is configurable in Settings > Data Grid
ControlAction
First pageJump to page 1
Previous pageGo back one page
Page indicatorShows current page / total pages
Next pageGo forward one page
Last pageJump to the last page
Server-side pagination is memory efficient. Only the visible page of data is kept in memory, even for tables with millions of rows.

Query Tabs (Client-Side Pagination)

Query tabs execute the full query and receive all results. For large result sets, TablePro applies client-side pagination:
  • Results are stored in memory
  • Pagination slices the result array without re-querying
  • Sorting is done locally on the cached results

Page Size Configuration

Configure the default page size in Settings > Data Grid:
OptionRows per Page
Small100
Medium500
Large1,000
Custom10 - 100,000

Tab Context Menu

Right-click any tab to access the context menu:
ActionDescription
Duplicate TabCreate a copy of this tab
Pin Tab / Unpin TabToggle pin state
Close TabClose this tab
Close Other TabsClose all tabs except this one (respects pinned tabs)
Tab context menu

Keyboard Shortcuts

ActionShortcut
New query tabCmd+T
Close current tabCmd+W
New table (create)Cmd+Shift+N
Switch to tab 1-9Cmd+1 through Cmd+9
Previous tabCmd+Shift+[ or Cmd+Option+Left
Next tabCmd+Shift+] or Cmd+Option+Right

Best Practices

Organize by Task

Use separate tabs for different tasks: one for exploring data, another for writing migration queries, another for testing. This keeps your workspace organized.

Pin Important Tabs

Pin tabs containing queries you refer to frequently. This prevents them from being accidentally closed.

Use Table Tabs for Browsing

When you just need to look at data, click the table in the sidebar to open a table tab. This gives you pagination, editing, and structure view without writing SQL.

Use Query Tabs for Complex Work

For joins, aggregations, subqueries, and multi-statement operations, use query tabs. The SQL editor gives you full control over what executes.

Close Unused Tabs

While tabs are lightweight, closing tabs you no longer need keeps the tab bar clean and makes it easier to find what you are looking for.

Next Steps