Documentation/Performance & Analysis

Performance Tools

Performance & Analysis

Performance Tools

Tablen includes built-in performance monitoring and analysis tools to help you identify slow queries, understand execution plans, and optimize database performance.

Query Performance View

A centralized performance dashboard showing query execution metrics and trends.

Accessing Query Performance

  • Open from the Command Palette (Cmd+Shift+P): search for "Query Performance"
  • Available in the menu bar
  • Opens as a dedicated tab type

Time Filters

Filter Description
24h Last 24 hours
7d Last 7 days
30d Last 30 days

Summary Cards

The performance view displays four key metrics:

Metric Description
Average Execution Time Mean query duration across filtered entries
Total Memory Cumulative memory usage of all queries
Slow Queries Number of queries taking longer than 1 second
Full Table Scans Number of queries that performed full table scans

Sort Options

Sort the query list by:

  • Duration: Longest execution time first
  • Memory: Highest memory usage first
  • Recent: Most recently executed first

Execution Time Chart

A visual chart showing query execution times over the selected period using SwiftUI Charts:

  • Identifies patterns in query performance
  • Spots performance degradation over time
  • Highlights outlier queries

Query Details

Each entry in the performance list shows:

  • SQL query text
  • Execution time (duration)
  • Memory usage in bytes
  • Timestamp
  • Whether the query triggered a full table scan
  • EXPLAIN results (if available)

EXPLAIN Analyzer

Analyze query execution plans to understand how the database processes your queries.

Using EXPLAIN

  1. Write your query in the editor
  2. Run EXPLAIN through the toolbar or Command Palette
  3. The Explain Analyzer parses the output and provides insights

Analysis Results

The analyzer identifies:

  • Full Table Scans: Queries scanning entire tables without index usage
  • Missing Indexes: Columns that would benefit from indexes
  • Row Estimates: Estimated vs actual row counts
  • Cost Estimates: Query cost reported by the database engine
  • Join Methods: How tables are joined (nested loop, hash, merge)
  • Sort Operations: Whether sorts require temporary storage

EXPLAIN Plan Parser

The built-in parser understands EXPLAIN output from:

  • PostgreSQL (text and JSON formats)
  • MySQL (traditional and JSON formats)
  • SQLite EXPLAIN QUERY PLAN

Performance Logger

Automatic performance tracking for all executed queries:

Tracked Metrics

Metric Description
Execution Time Wall clock time for query execution
Memory Bytes Memory consumed during query execution
Timestamp When the query was executed
Has Full Table Scan Whether EXPLAIN detected a full scan
EXPLAIN Output Cached execution plan (when available)

Storage

Performance data is stored alongside query history:

  • Entries are persisted locally
  • Data is available for the Query Performance view
  • Older entries are automatically pruned

Memory Badges

The query toolbar displays memory and performance badges:

Badge Types

Badge Meaning
Memory usage Shows memory consumed by the last query
Warning badge Appears when a query is flagged as potentially problematic
Duration badge Shows execution time of the last query

When Badges Appear

  • After every query execution
  • Badges update automatically
  • Warning badges highlight slow queries or high memory usage

Slow Query Auto-EXPLAIN

Queries that exceed a performance threshold automatically trigger EXPLAIN analysis:

How It Works

  1. A query is executed normally
  2. If execution time exceeds the threshold (default: 1 second), Tablen automatically runs EXPLAIN
  3. The EXPLAIN output is parsed and stored
  4. Performance insights are displayed in the query toolbar
  5. The data feeds into the Query Performance view

Benefits

  • No manual intervention needed
  • Automatic detection of performance issues
  • Historical performance data for trend analysis
  • Helps identify queries that need optimization

Performance Best Practices

Using Performance Tools Effectively

  1. Regular Monitoring: Check the Query Performance view periodically
  2. Watch for Trends: Use the 7d and 30d filters to spot degradation
  3. Act on Warnings: When memory or warning badges appear, investigate
  4. Review EXPLAIN: For slow queries, review the execution plan
  5. Index Optimization: Use full table scan data to identify missing indexes

Reading EXPLAIN Output

  • Seq Scan: Full table scan -- consider adding an index
  • Index Scan: Good -- the database is using an index
  • Bitmap Scan: Acceptable -- used for medium-selectivity queries
  • Sort: Check if the sort can be covered by an index
  • Hash Join vs Nested Loop: Hash joins are better for large datasets
Was this page helpful?
Report an issue