db-storage-bloat
Skill22 starsChanged 5 months agoMITView on GitHub
Audit storage operability — VACUUM / autovacuum health and table-and-index bloat, transaction-ID wraparound risk (sev-5), and tombstone accumulation on wide-column stores. Module M18. Feeds the Performance & Scale score.
In this repository36 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- auditSkill
- checklistSkill
- db-antipatternsSkill
- db-concurrencySkill
- db-connection-poolingSkill
- db-constraintsSkill
- db-defaults-generatedSkill
- db-engine-selectionSkill
- db-index-hygieneSkill
- db-indexingSkill
- db-keysSkill
- db-migration-safetySkill
- db-multitenancySkill
- db-namingSkill
- db-normalizationSkill
- db-orchestratorSkill
- db-partitioning-shardingSkill
- db-platform-fitSkill
- db-query-patternsSkill
- db-referential-integritySkill
- db-replicas-viewsSkill
- db-security-accessSkill
- db-specialized-fitSkill
- db-temporal-historySkill
- db-types-precisionSkill
- designSkill
- explainSkill
- fixSkill
- introspectSkill
- migrateSkill
- nextSkill
- scoreSkill
- seedSkill
- stack-detectSkill
- startSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 72
Never quote a dead-tuple percentage or a days-to-wraparound number you cannot observe.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Copyright (c) 2026 Enrique Rocha (@soyenriquerocha) · tododeia.com · id er-f37b7121 -->db-storage-bloat (M18)
Storage operability keeps a database fast and alive over time; it is a Performance & Scale (axis
performance) concern, feeding relational Almacenamiento w12 (shared with M22/M20/M21) and the
Tombstones category in the wide-column profile. The catastrophic case — TXID wraparound — can
force a Postgres shutdown, so it is a severity:5 cap when imminent.
What it checks
- VACUUM / autovacuum health — autovacuum disabled or mis-tuned on a high-churn table, dead tuples accumulating, bloated tables/indexes inflating size and slowing scans.
- TXID wraparound —
age(datfrozenxid)(or per-tablerelfrozenxid) approachingautovacuum_freeze_max_age/ the 2-billion ceiling. Imminent wraparound isseverity:5,fail(perf) — but only with live age evidence; statically it is at most aneeds_apinudge. - Tombstones (wide-column) — Cassandra/Scylla heavy deletes / TTL churn producing tombstones that
degrade reads (
tombstone_warn_thresholdterritory).
Score / axis
Feeds performance only (relational Almacenamiento w12; Tombstones in the wide-column profile).
Tier-0 (static)
Almost all of M18 is runtime truth. Statically, detect autovacuum-disabling DDL/config
(autovacuum_enabled = false, aggressive fillfactor), high-delete/TTL access patterns, and
wide-column delete-heavy modeling. Dead-tuple counts, real bloat, frozen-xid age, and tombstone counts
all require a live DB → status: needs_api at Tier-0 (never a silent pass).
Tier-1/2 (verification query, Postgres)
-- TXID wraparound headroom (Tier-1):
SELECT datname, age(datfrozenxid) AS xid_age,
current_setting('autovacuum_freeze_max_age')::int AS freeze_max
FROM pg_database ORDER BY age(datfrozenxid) DESC;
-- dead tuples + last autovacuum (Tier-2):
SELECT relname, n_dead_tup, n_live_tup, last_autovacuum
FROM pg_stat_user_tables ORDER BY n_dead_tup DESC LIMIT 20;Method query_stat. xid_age near freeze_max (or the 2e9 ceiling) confirms wraparound as
established and capping. High n_dead_tup with stale/NULL last_autovacuum confirms bloat as
established; without sustained stats, bloat stays directional.
Findings
Emit findings per schema/finding.schema.json. Examples:
M18.db.txid_wraparound_imminent—xid_ageapproaching the ceiling (severity:5,fail, axisperformance, confidenceestablishedTier-1 only /needs_apiTier-0,fixable: advisory— aggressiveVACUUM (FREEZE)).M18.events.autovacuum_disabled— autovacuum turned off on a churny table (severity:3,warn,establishedfrom DDL,fixable: proposed).M18.events.dead_tuple_bloat— high dead-tuple ratio (severity:3,warn,establishedTier-2 /needs_api,fixable: advisory).
Each finding: evidence.observed quotes the config/DDL line or the catalog/stats row verbatim;
verification.reproduce is the query above referencing $DATABASE_URL; expected_impact is banded +
confidence-tagged (no naked %).
Honesty
- Wraparound sev-5 requires live
age()evidence — never declare it imminent from files; absent a connection, emitneeds_api, which never caps. - Some "bloat" is normal steady-state headroom; flag it only against a churn pattern or measured dead
ratio, and mark file-only verdicts
directional. - Never quote a dead-tuple percentage or a days-to-wraparound number you cannot observe; magnitude is
banded only. Routine maintenance fixes (
VACUUM, autovacuum tuning) areproposed/advisory.
Remedy — keep updates HOT
On an update-heavy table, lowering FILLFACTOR (e.g. the default 100/90 → 70) leaves free space in
each page so an UPDATE can place the new row version on the same page as a HOT (Heap-Only Tuple)
update — which skips writing new index entries, curbing index write-amplification and slowing bloat
growth. HOT only fires when no indexed column changed and the page has room, so a lower FILLFACTOR plus
not over-indexing the churned columns is the lever. This is the positive counterpart to the autovacuum/bloat
findings above; emit it as fixable: proposed (a FILLFACTOR change rewrites only on subsequent updates).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

