-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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:
- Navigate to "SQL command"
- Paste complex monitoring queries from external files
- Execute and analyze results
- 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:
-
Save Query Button:
- After executing a query, show a "Save" button
- Prompt for query name/description
- Store in browser localStorage or session cookies
-
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
-
Query Categories:
- Allow organizing saved queries into categories (e.g., "Monitoring", "Performance", "Backups")
- Import/export saved queries as JSON
-
Quick Templates:
- Pre-built query templates for common tasks:
- Connection health check
- Slow query detection
- Lock monitoring
- Cache hit ratio
- Table sizes
- Pre-built query templates for common tasks:
Use Case Examples
Scenario 1: Production Incident
During a connection exhaustion event, I need to:
- Quickly see current connection count (one click)
- Identify which application is using too many connections
- Kill stale connections if needed
- 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
- Faster troubleshooting: No need to maintain external query files
- Real-time monitoring: Auto-refresh eliminates manual re-execution
- Reduced errors: Pre-built queries prevent SQL syntax mistakes
- Better DBA experience: Aligns Adminer with modern database tools
Alternative Workarounds (Current State)
Users currently must:
- Create database views (
CREATE VIEW v_connection_health AS ...) - Use browser bookmarks with query parameters in URL
- Maintain external
.sqlfiles - 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:
- Preferred approach (Option A, B, or both?)
- Code structure/conventions
- 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!