Skip to content
aj-geddes avatar

Database Monitoring

Database monitoring guide covering connections, query performance, indexes, and PostgreSQL and MySQL setup.

CCM score
35 of 100
skills.sh installs
470
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers performance baselines, real-time health checks, capacity planning, and incident troubleshooting for databases
  • Includes SQL queries against pg_stat_activity for connection counts, long-running queries, and idle transactions
  • Provides seven reference guides for connection, query, table and index, performance schema, InnoDB, and dashboard monitoring
  • Designed for teams setting up monitoring, analyzing metrics, or diagnosing database issues

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill database-monitoring -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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)

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Databases, DevOps & Cloud
First seen
Jun 3, 2026

Questions

What does the database-monitoring skill do?

The database-monitoring skill sets up performance and health monitoring for databases, covering metrics collection, analysis and troubleshooting. Its SKILL.md includes SQL queries that check current connections, connection counts per database and idle transactions in PostgreSQL.

How do I install the database-monitoring skill?

Run npx -y skills add aj-geddes/useful-ai-prompts --skill database-monitoring -y in a project to install it. Once installed, database-monitoring lets the agent set up monitoring, analyze database metrics and troubleshoot database issues.

When should I use the database-monitoring skill?

Use database-monitoring for performance baseline setup, real-time health checks, capacity planning, query performance analysis and alerting rule configuration. It also covers incident response when a database misbehaves.

Which databases does database-monitoring cover?

The database-monitoring skill has reference guides for PostgreSQL monitoring setup, InnoDB monitoring and MySQL Performance Schema. It also covers connection, query, table and index monitoring plus an automated monitoring dashboard.

More from aj-geddes/useful-ai-prompts

All 258

Similar to Database Monitoring

More Databases