Skip to content

Feature Request: Add Database Health Monitoring Dashboard and Query Bookmarking #1206

@Chaitanya-Varun

Description

@Chaitanya-Varun

Summary

As a database administrator managing high-traffic PostgreSQL databases, I need quick access to connection health metrics and the ability to save/bookmark frequently used
monitoring queries. Currently, Adminer lacks built-in health monitoring capabilities and convenient query management features.

Problem Statement

When troubleshooting connection pool issues, transaction timeouts, or database performance problems, I need to repeatedly:

  1. Navigate to "SQL command"
  2. Paste complex monitoring queries from external files
  3. Execute and analyze results
  4. Repeat this process every few minutes for real-time monitoring

This workflow is inefficient and error-prone, especially during production incidents.

Proposed Solution

Option A: Built-in Health Monitoring Dashboard (Preferred)

Add a new "Health" or "Monitoring" menu item in the left sidebar that displays:

Connection Health Panel:

  • Current connections vs max connections (with percentage bar)
  • Active / Idle / Idle-in-transaction breakdown
  • Connection utilization graph (simple text-based or basic SVG)
  • Stale connection count (connections idle > 5 minutes)

Top Queries Panel:

  • Currently running queries (auto-refresh every 5 seconds)
  • Long-running queries (> 30 seconds)
  • Queries waiting on locks

Application Breakdown:

  • Connections grouped by application_name
  • State distribution per application

Quick Actions:

  • "Kill stale connections" button (with confirmation)
  • "Refresh" button for manual updates
  • Auto-refresh toggle (5s, 10s, 30s intervals)

Option B: Query Bookmarking System

Enhance the existing "SQL command" page with:

  1. Save Query Button:

    • After executing a query, show a "Save" button
    • Prompt for query name/description
    • Store in browser localStorage or session cookies
  2. Saved Queries Dropdown:

    • Add a "Load Saved Query" dropdown at top of SQL command page
    • List all saved queries with names
    • Click to load into editor
  3. Query Categories:

    • Allow organizing saved queries into categories (e.g., "Monitoring", "Performance", "Backups")
    • Import/export saved queries as JSON
  4. Quick Templates:

    • Pre-built query templates for common tasks:
      • Connection health check
      • Slow query detection
      • Lock monitoring
      • Cache hit ratio
      • Table sizes

Use Case Examples

Scenario 1: Production Incident

During a connection exhaustion event, I need to:

  1. Quickly see current connection count (one click)
  2. Identify which application is using too many connections
  3. Kill stale connections if needed
  4. Monitor recovery in real-time

Current workaround: Manually run queries repeatedly, copy-pasting from text files.

Scenario 2: Daily Health Checks

Every morning, I check:

  • Connection pool utilization
  • Slow queries from yesterday
  • Lock contention incidents

Current workaround: Maintain a separate file of SQL queries, manually execute each one.

Technical Considerations

For Health Dashboard:

  • Use PostgreSQL system views: pg_stat_activity, pg_stat_database, pg_locks
  • Auto-refresh using JavaScript setInterval()
  • Minimal CSS for compact display
  • Optional: Make it collapsible/expandable

For Query Bookmarking:

  • Store in browser localStorage (no backend changes needed)
  • JSON format for import/export
  • Keep Adminer's lightweight philosophy

Similar Features in Other Tools

  • pgAdmin 4: Has a "Dashboard" tab showing connection graphs
  • phpMyAdmin: Has "Query bookmarks" feature for saved queries
  • DBeaver: Has "SQL templates" and connection monitoring

Benefits

  1. Faster troubleshooting: No need to maintain external query files
  2. Real-time monitoring: Auto-refresh eliminates manual re-execution
  3. Reduced errors: Pre-built queries prevent SQL syntax mistakes
  4. Better DBA experience: Aligns Adminer with modern database tools

Alternative Workarounds (Current State)

Users currently must:

  1. Create database views (CREATE VIEW v_connection_health AS ...)
  2. Use browser bookmarks with query parameters in URL
  3. Maintain external .sql files
  4. Use third-party monitoring tools (Grafana, pgwatch2)

However, these workarounds defeat Adminer's purpose as a lightweight, all-in-one database management tool.

Mockup (Optional)

┌─────────────────────────────────────────────┐
│ Adminer - Schema: public │
├─────────────────────────────────────────────┤
│ Left Sidebar: │
│ • Alter schema │
│ • Database schema │
│ • SQL command │
│ • Import │
│ • Export │
│ ★ Health Monitor (NEW) │
│ • Create table │
│ │
│ Health Monitor Page: │
│ ┌─ Connections ──────────────────────────┐ │
│ │ 847 / 2000 (42%) [████████░░░░░░░░░░] │ │
│ │ Active: 45 Idle: 302 In-Txn: 2 │ │
│ └────────────────────────────────────────┘ │
│ │
│ ┌─ By Application ───────────────────────┐ │
│ │ core-py: 450 (250 active, 200 idle) │ │
│ │ api: 80 (8 active, 72 idle) │ │
│ │ core-go: 25 (5 active, 20 idle) │ │
│ └────────────────────────────────────────┘ │
│ │
│ ┌─ Active Queries ───────────────────────┐ │
│ │ PID | App | Duration | Query │ │
│ │ 1234 | core-py | 2.5s | SELECT ... │ │
│ └────────────────────────────────────────┘ │
│ │
│ [Refresh] [Auto-refresh: 5s ▼] [Kill Stale]│
└─────────────────────────────────────────────┘

Implementation Priority

  • High Priority: Query bookmarking (simpler to implement, high value)
  • Medium Priority: Basic health monitoring dashboard
  • Low Priority: Advanced features (graphing, alerting)

Compatibility

  • PostgreSQL: Full support (uses pg_stat_activity)
  • MySQL/MariaDB: Partial support (uses SHOW PROCESSLIST)
  • SQLite: Limited (no multi-connection concept)

Willingness to Contribute

I am willing to contribute a pull request if this feature is accepted. Please provide guidance on:

  1. Preferred approach (Option A, B, or both?)
  2. Code structure/conventions
  3. Testing requirements

Environment

  • Adminer Version: 4.8.1
  • Database: PostgreSQL 16 (TimescaleDB)
  • Browser: Chrome 131
  • Use Case: Production database with 2000 max connections, 50+ concurrent workers

Thank you for considering this feature request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions