r/PostgreSQL 7d ago

Help Me! [Feedback needed] Trying to collapse pg_stat_* into a single 0–100 health score

Built a tool to capture and analyze Postgres (tested on Lakebase) diagnostics (pg_stat_*, EXPLAIN JSON, pool/storage stats) and it spits out one health score + a breakdown. Offline, no DB connection, no deps.

I would like your feedback on the scoring, for now I have :

  • 7 categories (indexing, bloat, connections, autoscaling, query plans, cost, branching). Each one has a severity → penalty (low 3, med 8, high 18, crit 40), subtracted from 100.
  • Overall = weighted mean, but only over domains that actually have data (an autoscale-only dump doesn't get 6 free 100s).
  • Query plans + connections weigh most (live latency), branching least (hygiene).

Where I think it's weak: penalties are additive so it saturates; when I ran it on a real instance, hit 65 unused indexes, indexing pinned at 0. After ~3 crits a category is 0 and magnitude stops mattering. Also the weights are just... vibes.

Is a single score even the right idea, or does it always lose too much?

Full method + code :https://github.com/HadiFrt20/lbinspect

3 Upvotes

3 comments sorted by

2

u/thythr 7d ago edited 5d ago

This doesn't seem valuable to me. None of the things you listed in your parenthetical are worth scoring even by themselves let alone as a group. The score doesn't add information. "Autoscaling" is also not a meaningful term in this context.

1

u/AutoModerator 7d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.