pg-bloat-analysis

pg-bloat-analysis is a skill for Claude Code, Codex from isdaniel/pgtuner_mcp. It costs 53 tokens per session (3,133 once invoked), scanned A, original, Apache-2.0.

A PostgreSQL database guide for finding table and index bloat, meaning wasted space caused by fragmentation and obsolete row versions.

In plain words
What is it for?
Use it to inspect dead rows, fragmentation, disk-space problems, and possible VACUUM, REINDEX, or pg_repack work.
Why use it?
It identifies why databases grow or slow down and suggests targeted maintenance actions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/isdaniel/pgtuner_mcp/pg-bloat-analysis
Any agent
npx skills add isdaniel/pgtuner_mcp --skill pg-bloat-analysis
Clone the repo
git clone --depth 1 https://github.com/isdaniel/pgtuner_mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pg-bloat-analysis

README.md
[![agentmods](https://agentmods.dev/badge/skills/isdaniel/pgtuner_mcp/pg-bloat-analysis.svg)](https://agentmods.dev/skills/isdaniel/pgtuner_mcp/pg-bloat-analysis)
Your own site
<a href="https://agentmods.dev/skills/isdaniel/pgtuner_mcp/pg-bloat-analysis"><img src="https://agentmods.dev/badge/skills/isdaniel/pgtuner_mcp/pg-bloat-analysis.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,133 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00053 $0.03133
Opus 5 $0.00026 $0.01566
Sonnet 5 $0.00011 $0.00627
Haiku 4.5 $0.00005 $0.00313

Measured 6d ago against content hash 11d1f40ab91d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pg-bloat-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pg-bloat-analysis/SKILL.md · 338 lines

How it starts

The opening of the file, as written. The whole thing — 338 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreSQL Bloat Analysis

This skill guides detection, analysis, and remediation of table and index bloat in PostgreSQL databases using pgtuner-mcp tools.

When to Use This Skill

Use this skill when the user:

  • Reports tables or indexes growing unexpectedly large
  • Asks about database bloat, dead tuples, or fragmentation
  • Mentions disk space running low
  • Sees slow sequential scans on tables that should be small
  • Asks "why is my table so large?" or "how do I reclaim disk space?"
  • Notices VACUUM not keeping up or autovacuum running constantly
  • Reports degraded performance after bulk DELETE or UPDATE operations

MCP Resources Available

  • pgtuner://health/bloat -- Quick bloat health assessment (lightweight)
  • pgtuner://table/{schema}/{table_name}/stats -- Table statistics including dead tuple counts
  • pgtuner://settings/autovacuum -- Autovacuum configuration (relevant for root cause analysis)

This skill is referenced by the health_check MCP Prompt (Step 6: Quick Bloat Scan). For dedicated bloat investigation, follow this skill's full workflow.

Prerequisites

  • The pgtuner-mcp server must be connected with a valid DATABASE_URI
  • Required: pgstattuple extension (for accurate bloat measurement)
  • Without pgstattuple: The tools fall back to statistical estimation (less accurate)

Pre-Flight Checks

  • If analyze_table_bloat or get_bloat_summary returns an error about pgstattuple, inform the user: "The pgstattuple extension is not installed. Bloat measurements will be estimated from pg_stat_user_tables statistics, which is less accurate. For precise measurements, install pgstattuple: CREATE EXTENSION pgstattuple;"

Agent Decision Tree

User reports bloat concerns
  |
  +--> General "how bloated is my database?"
  |    --> Start with Step 1 (get_bloat_summary)
  |
  +--> Specific table is too large
  |    --> Skip to Step 2 (analyze_table_bloat) for that table
  |
  +--> Disk space running low
  |    --> Start with Step 1, then prioritize high-bloat tables
  |
  +--> After Step 1, triage results:
       |
       +--> Dead tuple ratio > 20% on any table?
       |    --> Deep-dive Step 2, then investigate root cause (Step 5)
       |
       +--> XID age > 800M on any table?
       |    --> URGENT: redirect to pg-vacuum-tuning emergency procedures
       |
       +--> Index bloat > 40%?
       |    --> Step 3 (index bloat analysis), recommend REINDEX
       |
       +--> Autovacuum not keeping up?
            --> Step 4 (vacuum status), then pg-vacuum-tuning skill

Read the full file on GitHub · 338 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 338 lines · 53 tokens per session scan A 11d1f40ab91d

Subscribe to this mod's changes

pg-bloat-analysis is a skill published in the GitHub repository isdaniel/pgtuner_mcp (29 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 53 tokens to every session and 3,133 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

exasol-mcp-server

Exasol MCP Server usage guide: common workflows for database exploration, query debugging, BucketFS management, and working with UDFs and preprocessors.

exasol/mcp-server · 36 tokens

tencent-pg-slowquery-diagnosis

Diagnose slow SQL and performance anomalies for Tencent Cloud PostgreSQL by calling Tencent Cloud OpenAPI directly. This skill can use the full aligned PostgreSQL OpenAPI action set documented in @references/apireference.md. Start with evidence collection first, and require explicit confirmation before any write…

TencentCloudCommunity/mcp-server · 75 tokens

amazon aurora dsql

Deprecated compatibility redirect for Aurora DSQL guidance. Use when a request concerns DSQL, Aurora DSQL, distributed SQL, DSQL schemas, migrations, queries, authentication, performance, or application development.

awslabs/mcp · 46 tokens

sql-optimizer

Analyzes SQL queries for missing indexes, N+1 patterns, suboptimal joins, and full table scans. Interprets EXPLAIN, detects anti-patterns, rewrites queries. Triggers on: "optimize this query", "slow query", "add indexes", "explain plan", "N+1 query", "why is this query slow".

Mathews-Tom/armory · 78 tokens

ecto-constraint-debug

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.

oliver-kriska/claude-elixir-phoenix · 36 tokens

solr-query

To build and debug Solr queries: eDisMax, block join, JSON facets, kNN, explain.

griddynamics/rosetta · 27 tokens