Read a slow Postgres EXPLAIN ANALYZE plan, rewrite the query for selectivity, and propose targeted indexes with cost estimates.
Reads a Postgres EXPLAIN (ANALYZE, BUFFERS) plan for a slow query, identifies the dominant cost node, and proposes either a query rewrite or a new index. Output cites concrete plan fragments and includes the rewritten SQL.
plan_path: a text file containing EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) output.query_path: the original SQL.schema_dump: output of pg_dump --schema-only to ground index recommendations in current indexes.Actual Total Time, Rows, Plan Rows, and Node Type.Actual Total Time (self time = total minus child sums).Filter and Recheck Cond. Identify columns that would benefit from a btree or partial index.schema_dump to avoid duplicates; suggest a partial index when the filter has high selectivity (e.g., WHERE deleted_at IS NULL).ANALYZE <table> first; if the table is freshly analyzed, suggest extended statistics (CREATE STATISTICS).IN (...) with > 100 values) and rewrite to a temp table or ANY(VALUES (...)).A markdown report query-optimization.md containing the summary, the proposed CREATE INDEX statements, the rewritten query, and a verification checklist (e.g., "rerun EXPLAIN ANALYZE after creating the index, confirm Index Scan is chosen").
Provide the reader a checklist to run: create the suggested index in a non-prod replica, rerun the original query with EXPLAIN ANALYZE, and confirm the dominant node changed. Compare Actual Total Time before/after — at least a 30% reduction is the success bar for the report's claim. If the suggested index is larger than 25% of the table size, downgrade the suggestion to "consider, with caveats" rather than recommend outright.
work_mem.ANALYZE before deeper tuning.Other publishers' experience with this skill. Self-rating is blocked.
Ratings are limited to publishers while the registry is small — sign in and publish a public skill to rate.
No ratings yet. Be the first.
Same domains or capabilities as amitte/sql-query-optimizer.
Narrate A/B test results from a structured summary into a plain-English readout including effect size, statistical significance, and the recommended decision.
Explain a metric anomaly from a time-series excerpt and a list of known events — produce candidate causes ranked by plausibility with grounded evidence.
Run a backup-restore drill: pick a recent snapshot, restore to a sandbox database, and verify data integrity with row counts and checksums.
Suggest a chart type from a dataset description and an analytical goal — pick one primary chart and one fallback, with rationale grounded in field cardinality.
Define a cohort from criteria like signup date, plan, and behavior — produce a deterministic SQL or dbt model that yields a stable user list.
Run a retention analysis on an event log, build cohort-by-week-by-period tables, and emit the retention curves as CSV and chart-ready JSON.