pg-performance-baseline — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited pg-performance-baseline (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill guides creation of a comprehensive performance baseline report for a PostgreSQL database, intended for comparison before and after making configuration changes, schema modifications, or infrastructure upgrades.
Use this skill when the user:
pgtuner://docs/tools -- Tool reference for parameter detailspgtuner://docs/prompts -- Available prompt templatespgtuner://settings/{category} -- Settings by category (use for structured capture: memory, checkpoint, wal, autovacuum, connections)pgtuner://health/{check_type} -- Targeted health metrics by typepgtuner://table/{schema}/{table_name}/stats -- Quick per-table statsThis skill corresponds to the `performance_baseline` MCP Prompt. If the user triggers that prompt, follow this skill's workflow.
DATABASE_URIpg_stat_statements extension (for query workload data)pgstattuple extension (for bloat measurements)pg_stat_statements reset for meaningful workload dataBefore starting:
|
+--> Is this a "before" baseline (pre-change)?
| --> Collect all 8 steps, save results systematically
| --> Tell user: "Baseline collected. After making changes, ask me to
| collect another baseline and I will generate a comparison."
|
+--> Is this an "after" baseline (post-change)?
| --> Collect all 8 steps with identical parameters
| --> Generate the Comparison Template with before/after diff
|
+--> Is this a standalone performance report?
--> Collect all 8 steps
--> Include recommendations inline (not just metrics)Collect all data systematically. Each step gathers a different performance dimension.
Tool: check_database_health
Parameters:
include_recommendations: true
verbose: trueRecord:
Tool: get_slow_queries
Parameters:
limit: 20
min_calls: 1
order_by: "mean_time"Then also sort by total time to find the highest aggregate cost:
Tool: get_slow_queries
Parameters:
limit: 20
min_calls: 1
order_by: "calls"Also capture over-fetching patterns:
Tool: get_slow_queries
Parameters:
limit: 10
min_calls: 5
order_by: "rows"Record:
temp_blks_written > 0 (work_mem issues)Tool: get_table_stats
Parameters:
schema_name: "public"
include_indexes: true
order_by: "size"Also check for vacuum maintenance gaps:
Tool: get_table_stats
Parameters:
schema_name: "public"
include_indexes: false
order_by: "last_vacuum"And tables with most sequential scans (index candidates):
Tool: get_table_stats
Parameters:
schema_name: "public"
include_indexes: false
order_by: "seq_scans"Record:
Capture settings by category for structured comparison:
Tool: review_settings
Parameters:
category: "memory"
include_all_settings: falseTool: review_settings
Parameters:
category: "checkpoint"
include_all_settings: falseTool: review_settings
Parameters:
category: "wal"
include_all_settings: falseTool: review_settings
Parameters:
category: "autovacuum"
include_all_settings: falseTool: review_settings
Parameters:
category: "connections"
include_all_settings: falseRecord key settings in categories:
Memory:
WAL / Checkpoints:
Autovacuum:
Connections:
Planner:
Tool: find_unused_indexes
Parameters:
schema_name: "public"
min_size_mb: 0.1
include_duplicates: trueRecord:
Tool: analyze_wait_events
Parameters:
active_only: trueRecord:
Tool: analyze_disk_io_patterns
Parameters:
analysis_type: "all"
top_n: 20Record:
Tool: get_bloat_summary
Parameters:
schema_name: "public"
top_n: 10Record:
Structure the baseline as a timestamped report:
Database: <database_name> Collected: <timestamp> PostgreSQL Version: <version> Uptime: <uptime>
#### 1. Health Summary
| Dimension | Score | Notes |
|---|---|---|
| Overall | XX | |
| Connections | XX | X/Y used |
| Cache | XX | Hit ratio: XX.X% |
| Locks | XX | |
| Wraparound | XX | Oldest XID: XXM |
| Checkpoints | XX | Requested: X%, Timed: X% |
#### 2. Workload Profile
| Metric | Value |
|---|---|
| Total unique queries tracked | X |
| Top query mean time | X ms |
| Top query total time | X sec |
| Average cache hit ratio | XX.X% |
| Queries > 100ms mean time | X |
| Queries > 1s mean time | X |
Top 5 by mean execution time:
| Query (truncated) | Mean Time | Calls | Total Time |
|---|---|---|---|
| SELECT ... | X ms | X | X s |
#### 3. Storage Profile
| Metric | Value |
|---|---|
| Total tables | X |
| Total data size | X GB |
| Total index size | X GB |
| Largest table | X (X GB) |
| Tables with > 10% dead tuples | X |
| Tables never vacuumed | X |
#### 4. Index Profile
| Metric | Value |
|---|---|
| Total indexes | X |
| Unused indexes | X (X MB wasted) |
| Duplicate indexes | X |
| Index-to-table size ratio | X:1 |
#### 5. Configuration Highlights
| Setting | Current | Recommended | Gap |
|---|---|---|---|
| shared_buffers | X | X | OK / Needs change |
| work_mem | X | X | OK / Needs change |
| ... | ... | ... | ... |
#### 6. I/O Profile
| Metric | Value |
|---|---|
| Buffer cache hit ratio | XX.X% |
| Temp files created (since reset) | X |
| Checkpoint frequency (req/timed) | X% / X% |
#### 7. Current Issues
Numbered list of any active problems found during the baseline collection.
When collecting a second baseline after changes, present a diff:
| Metric | Before | After | Change |
|---|---|---|---|
| Health score | 82 | 91 | +9 |
| Cache hit ratio | 97.2% | 99.4% | +2.2% |
| Top query mean time | 450ms | 120ms | -73% |
| Unused index waste | 2.4 GB | 0.3 GB | -88% |
pg_stat_statements has been collecting since the last resetANALYZE to be accurate: check last_analyze timestampspgstattuple are I/O intensive on large tables (use use_approx: true for tables > 50 GB)Since baselines are snapshots, "verification" means collecting a second baseline for comparison:
After collecting a baseline, the agent should recommend specific skills based on findings:
pg-health-check for deeper investigationpg-slow-query-diagnosis skillpg-index-optimization skillpg-bloat-analysis skillpg-config-tuning skillpg-io-deep-dive skill| Feature | Version | Impact on Baseline |
|---|---|---|
pg_stat_statements total_exec_time | PG13+ | Column renamed from total_time |
pg_stat_io | PG16+ | Additional I/O metrics available |
compute_query_id | PG14+ | Required for queryid |
pgstattuple_approx() | PG9.5+ | Faster bloat estimation |
analyze_table_bloat with use_approx: false) are I/O intensive and should use use_approx: true for very large tables during peak hours~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.