Skip to main content

pgverdict

Status: pre-alpha, under active development. Nothing here is usable yet — this repository is public from day one by design. The first useful milestone (M1) is in progress.

Postgres performance MCP server with a verification loop. Instead of "I think this index will help", pgverdict aims for:

"This index reduced query X from 340 ms to 18 ms on a data clone, cost ~0.3 ms per write across 3 400 writes/day, no regression across the top 20 queries — here is the migration."

Every recommendation carries evidence. When evidence cannot be produced, the tool says so explicitly instead of guessing. A recommendation without a measurement is a bug, not a feature.

Why

Small teams run production Postgres without a DBA. When something gets slow they either ask an LLM and apply a plausible-sounding index blind, or open a dashboard they lack the expertise to interpret. Existing index advisors emit suggestions from planner cost estimates — they don't measure the result, don't account for write amplification, and don't check whether the new index regresses other queries.

pgverdict is an MCP server: the agent (e.g. Claude Code) drives the iteration, pgverdict provides the method — identify, ground, simulate, measure, check regressions, and only then deliver a verdict with the migration.

The verification loop

  1. Identify — rank real hotspots from pg_stat_statements and table/index statistics
  2. Ground — recover realistic bind parameters (real values matter: three orders of magnitude can hide behind a $1)
  3. Simulate — HypoPG virtual index, EXPLAIN cost delta — estimates only
  4. Measure — real index on a data-bearing clone, EXPLAIN (ANALYZE, BUFFERS) — estimates become evidence
  5. Regress — re-run the top-N workload, estimate write amplification, produce a net verdict

Every tool output carries an evidence_level: estimate_only | simulated | measured. Only measured results can become a verdict and a migration.

Safety posture

  • Local developer tool, stdio transport, no listening port
  • Production is opened read-only (pg_monitor-based role, read-only transactions, strict timeouts); no code path writes to production
  • Generated migrations are files, never executed
  • Database-derived text is treated as data, never as instructions; literals are redacted by default

Roadmap

  • M1 — hotspot listing, plan explanation, dead-weight (unused/duplicate index) detection; bundled Docker testbed with a synthetic workload so you can try it in minutes without risking a real database
  • M2 — HypoPG simulation and index proposals, parameter recovery
  • M3 — data-bearing clones and real measurement with regression checks
  • M4 — migration generation, auto_explain parsing, weekly report mode

See docs/pgverdict-spec-v0.3.md for the full working spec.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgverdict-0.0.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgverdict-0.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pgverdict-0.0.1.tar.gz.

File metadata

  • Download URL: pgverdict-0.0.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgverdict-0.0.1.tar.gz
Algorithm Hash digest
SHA256 07c9eef16e67b78431b965dd3acbbf859a65c6409e5b34cc36a2f25bc7f48eee
MD5 4794f617f5d9cbfd0a94234022b36522
BLAKE2b-256 4fbd3e1d0bc2d1e6cf32f4f4063568d6382d60359e808dfbc13b3d802b4d7fb5

See more details on using hashes here.

File details

Details for the file pgverdict-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pgverdict-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgverdict-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bce49f21e3964315d674f777e5e8fa621fb1b5f54c7172ca8f31e86e3f0bea
MD5 32929f8f8fd4e8196d6f88f834d2cd23
BLAKE2b-256 164c5ca23f2913283eb9bfdb5502f1643e5e30ba1ffae9279c598bcf75528466

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page