Skip to main content

Query History

TablePro automatically saves every query you execute, making it easy to find, re-run, or modify previous queries. The query history persists across sessions and can be searched with full-text search.
Query History

Accessing History

History Panel

Open the history panel:
  1. Click View > Query History
  2. Or use the keyboard shortcut Cmd+Y
  3. Or click the History icon in the toolbar

History in Sidebar

Recent queries also appear in the sidebar under the active connection.

History Features

Query List

The history panel displays:
ColumnDescription
QueryThe SQL text (truncated if long)
TimeWhen the query was executed
DurationExecution time
StatusSuccess or error
DatabaseDatabase/connection used

Sorting

Sort history by:
  • Time: Most recent first (default)
  • Duration: Slowest queries first
  • Query text: Alphabetically
Click column headers to change sort order.

Filtering

Filter queries by:
  • Connection: Show only queries from specific connection
  • Status: Show only successful or failed queries
  • Time range: Today, this week, this month, all time

Searching History

Type in the search box to find queries containing specific text:
SELECT users  -- Find all queries containing "SELECT" and "users"
History search

Search Tips

  • Search is case-insensitive
  • Partial matches are included
  • Search looks at the full query text
Example searches:
SearchFinds
usersQueries mentioning “users”
JOIN ordersQueries joining orders table
WHERE createdQueries filtering by created
UPDATE users SETUpdate statements on users

Using History

Re-running Queries

To re-run a query from history:
  1. Find the query in the history list
  2. Double-click the query
  3. It loads into the SQL editor
  4. Press Cmd+Enter to execute
Or right-click and select Run Query.

Copying Queries

To copy a query:
  1. Select the query in the list
  2. Right-click > Copy Query
  3. Or press Cmd+C
The full query text is copied to clipboard.

Editing Before Running

To modify a historical query:
  1. Double-click to load into editor
  2. Make your changes
  3. Execute the modified query
The original history entry is preserved; a new entry is created for the modified query.

History Storage

Where History is Stored

Query history is stored in:
~/Library/Application Support/TablePro/query_history.db
This SQLite database contains:
  • Query text
  • Execution timestamp
  • Duration
  • Connection/database info
  • Success/failure status
  • Error messages (if failed)

History Retention

Configure history retention in Settings > History:
SettingDefaultDescription
Max Entries10,000Maximum queries to store
Max Days90Delete queries older than this
Auto CleanupOnAutomatically remove old entries
Set Max Entries to 0 for unlimited history (may impact performance with very large histories).

Clearing History

To clear all history:
  1. Open Settings > History
  2. Click Clear All History
  3. Confirm the action
Clearing history cannot be undone. Consider exporting important queries first.
To clear history for a specific connection:
  1. Right-click the connection in sidebar
  2. Select Clear History

Query Details

Viewing Full Query

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

Execution Details

Each history entry includes:
DetailDescription
StartedTimestamp when execution began
DurationHow long the query took
Rows affectedNumber of rows returned/modified
ErrorError message if query failed

Failed Queries

Failed queries show:
  • The error message
  • The query that caused the error
  • Timestamp of the failure
This helps debug issues:
  1. Find the failed query
  2. Read the error message
  3. Load into editor
  4. Fix and re-run

Best Practices

Annotating Queries

Add comments to important queries for easier searching:
-- Monthly revenue report 2024
SELECT
    DATE_FORMAT(created_at, '%Y-%m') as month,
    SUM(total) as revenue
FROM orders
WHERE created_at >= '2024-01-01'
GROUP BY month;
Now you can search for “Monthly revenue report” to find it.

Organizing with Comments

Use consistent comment patterns:
-- [REPORT] User growth
-- [DEBUG] Performance issue
-- [ADMIN] Data cleanup
-- [TEMP] Testing query

Exporting Important Queries

For queries you want to keep permanently:
  1. Find the query in history
  2. Copy to a SQL file
  3. Save in version control

Keyboard Shortcuts

ActionShortcut
Open historyCmd+Y
Search historyCmd+F (when history is open)
Load selected queryEnter or double-click
Copy queryCmd+C

Troubleshooting

History Not Saving

  1. Check disk space - history needs storage
  2. Verify TablePro has write permissions
  3. Check if history is disabled in settings
For very large histories:
  1. Reduce Max Entries in settings
  2. Clear old history
  3. Use more specific search terms

Missing Old Queries

Check Max Days setting - queries older than this limit are automatically deleted. To prevent automatic deletion:
  1. Open Settings > History
  2. Set Max Days to 0 (unlimited)

Duplicate Entries

Each execution creates a new history entry, even for identical queries. This is intentional to track when queries were run.

Next Steps