neon-postgres-egress-optimizer

Diagnose and fix Postgres query patterns causing excessive database egress costs.

Updated Sep 19, 2026
One-click install
npx skills add https://github.com/paramcodes/autobro --skill neon-postgres-egress-optimizer-paramcodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neon-postgres-egress-optimizer
Source: https://github.com/paramcodes/autobro/tree/main/.grok/skills/neon-postgres-egress-optimizer
Command: npx skills add https://github.com/paramcodes/autobro --skill neon-postgres-egress-optimizer-paramcodes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unexpectedly high Postgres database bills are usually caused by application queries transferring far more data than they use. This Skill walks you through finding the worst offending queries and fixing the anti-patterns behind them. ## Core Features & Use Cases - Egress Diagnosis: Uses pg_stat_statements to rank queries by total rows returned, rows per call, call frequency, and execution time. - Anti-Pattern Fixes: Provides concrete before/after rewrites for SELECT *, missing pagination, high-frequency queries on static data, application-side aggregation, and JOIN duplication. - Verification Workflow: Resets stats, re-measures after fixes, and checks that API responses still match expected shapes. - Use Case: Your Neon bill jumped this month. Run the diagnostic queries, discover an unpaginated endpoint returning 10,000 rows per request, add LIMIT/OFFSET pagination, and confirm the data transfer drops. ## Quick Start Ask the AI to diagnose why your Neon database bill is so high and fix the queries causing excessive data transfer.

Frequently Asked Questions about neon-postgres-egress-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce my Neon Postgres egress costs?▼

Reduce Neon egress by finding queries that transfer the most data with pg_stat_statements, then fixing anti-patterns like SELECT *, missing pagination, and JOIN duplication. Select only needed columns, bound result sets with LIMIT, and cache frequently called static data.

How to find which Postgres queries transfer the most data?▼

Use the pg_stat_statements extension to rank queries by total rows returned, average rows per call, and call frequency. Queries returning many wide rows with JSONB or TEXT columns, or called extremely often, are the biggest egress contributors.

Why is my Postgres database bill so high?▼

High Postgres bills usually come from the application fetching more data than it uses, not from the database itself. Common causes are unpaginated list endpoints, SELECT * pulling large JSONB columns, and aggregating raw rows in application code instead of SQL.

Does pg_stat_statements work on Neon?▼

Yes, pg_stat_statements is available on Neon by default but may still require CREATE EXTENSION IF NOT EXISTS pg_stat_statements. Note that stats are cleared when a Neon compute scales to zero and restarts, so reset stats and measure under representative traffic.

When should I split a JOIN into two queries to reduce data transfer?▼

Split a JOIN when a wide parent row is duplicated across many child rows, such as a product with a 50KB JSONB column joined to 200 reviews. Fetching parent and child in two separate queries eliminates the repeated parent data transfer.