
Database Monitoring
Covers the essentials for keeping tabs on database health, from connection counts and query duration to index usage and lock contention. The queries here are PostgreSQL-focused but the monitoring principles apply broadly. You'll want this when you're setting up observables for the first time, diagnosing slow queries, or building dashboards to catch problems before they wake you up. The reference guides break down connection monitoring, query performance, and table/index metrics into copy-paste examples. It's practical stuff, though you'll still need to wire these queries into whatever monitoring stack you're actually running.
- skills.sh installs
- 467
- GitHub stars
- 379
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill database-monitoring --agent claude-codeInstalls into .claude/skills of the current project.
Files
Database Monitoring
Table of Contents
Overview
Implement comprehensive database monitoring for performance analysis, health checks, and proactive alerting. Covers metrics collection, analysis, and troubleshooting strategies.
When to Use
- Performance baseline establishment
- Real-time health monitoring
- Capacity planning
- Query performance analysis
- Resource utilization tracking
- Alerting rule configuration
- Incident response and troubleshooting
Quick Start
Minimal working example:
-- View current connections
SELECT
pid,
usename,
application_name,
client_addr,
state,
query_start,
state_change
FROM pg_stat_activity
WHERE state != 'idle'
ORDER BY query_start DESC;
-- Count connections per database
SELECT
datname,
COUNT(*) as connection_count,
MAX(EXTRACT(EPOCH FROM (NOW() - query_start))) as max_query_duration_sec
FROM pg_stat_activity
GROUP BY datname;
-- Find idle transactions
SELECT
pid,
usename,
// ... (see reference guides for full implementation)
Sponsors
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, DevOps & CI/CD, AI & Agent Building, Debugging, Databases
- First seen
- Jun 3, 2026
More from aj-geddes/useful-ai-prompts
All 258- Idempotency Handling467
- Session Management466
- Query Caching Strategies465
- Risk Assessment465
- Error Tracking463
- Spring Boot Application463
- Code Metrics Analysis462
- Health Check Endpoints461
- Serverless Architecture461
- Transaction Management461
- Webhook Integration461
- Secrets Rotation459
- Runbook Creation458
- Deployment Documentation457
- Stored Procedures457
- Autoscaling Configuration456
- Profiling Optimization456
- Cpu Profiling455
- Security Documentation455
- Frontend Routing454
- Load Balancer Setup454
- Property Based Testing454
- Aws Rds Database453
- Log Aggregation453