jnidzwetzki
21
3
100% credibility
Found Feb 24, 2026 at 19 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Python
AI Summary

A tool that captures and visualizes all alternative query execution plans considered by PostgreSQL's optimizer during planning.

How It Works

1
🔍 Discover the tool

You're puzzled why your database queries run slowly and learn about a helpful tool that reveals all the different ways your database thinks about answering them.

2
📦 Get the tool

Download and set up the tool on your computer with a simple one-step install.

3
🔗 Connect to your database

Tell the tool where your database program is located and a special file it needs, then start watching.

4
👀 Watch queries in action

Run your usual data lookups in the database while the tool quietly records every option it considers.

5
📊 See all the options

Get a clear list of every possible way the database could run your query, including costs and which one it picked.

6
🖼️ Make visual maps

Turn the results into easy-to-read pictures or interactive graphs that show the decision paths.

🚀 Unlock faster queries

Now you understand the database's choices and can tweak things to make your data fetch quicker and smarter.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 19 to 21 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is pg_plan_alternatives?

pg_plan_alternatives is a Python tool that traces every query plan PostgreSQL considers during optimization, revealing alternatives beyond the single EXPLAIN output. Using eBPF like projects in aya ebpf github, bcc ebpf github, or cilium ebpf github, it captures startup/total costs, row estimates, and relation details for paths like scans and joins. Run it via CLI on a Postgres PID or binary (needs root and nodetags.h), output to JSON, then visualize as interactive graphs with visualize_plan_graph.

Why is it gaining traction?

Unlike standard EXPLAIN, it exposes the full optimizer decision tree—seq scans vs index vs hash joins—with costs and chosen paths highlighted, helping pinpoint why "bad" plans win. Graphs group alternatives by relation or join type, resolving OIDs to table names via DB connection, beating manual log dives. For eBPF fans exploring rust ebpf github or xdp ebpf github, it's a practical PostgreSQL tracer akin to github opentelemetry ebpf.

Who should use this?

Postgres DBAs debugging slow queries where EXPLAIN lies, performance engineers tuning complex joins on PG 17/18, or teams building query planners needing visibility into alternatives. Ideal for Linux prod tracing production backends, not ad-hoc dev.

Verdict

Grab it if you're deep in Postgres query planning—solid docs, PyPI install, and MIT license make it easy to try despite 19 stars and 1.0% credibility score. Beta maturity means debug symbols required and no parallel plans yet; test locally first.

(198 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.