neon-postgres-egress-optimizer

Diagnose and fix Postgres query patterns that cause excessive database egress costs.

Updated Sep 13, 2026
One-click install
npx skills add https://github.com/Abhi-0930/online--lms --skill neon-postgres-egress-optimizer-abhi-0930
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neon-postgres-egress-optimizer
Source: https://github.com/Abhi-0930/online--lms/tree/main/backend/.agents/skills/neon-postgres-egress-optimizer
Command: npx skills add https://github.com/Abhi-0930/online--lms --skill neon-postgres-egress-optimizer-abhi-0930

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unexpectedly high Postgres network transfer bills usually come from application code fetching more data than it uses. This Skill walks you through finding the queries responsible, fixing the anti-patterns behind them, and verifying the data transfer actually dropped. ## Core Features & Use Cases - Egress Diagnosis with pg_stat_statements: Run diagnostic SQL queries to rank statements by total rows returned, rows per call, call frequency, and execution time to pinpoint the biggest transfer contributors. - Anti-Pattern Fixes: Apply targeted fixes for SELECT * overfetching, missing pagination, high-frequency queries on static data, application-side aggregation, and JOIN duplication. - Verification Workflow: Reset stats, re-run diagnostics, and confirm API responses still match expected shapes after fixes. - Use Case: Your Neon bill jumped this month. Use this Skill to identify that an unpaginated products endpoint with a wide JSONB column is transferring hundreds of megabytes daily, then add column selection and LIMIT/OFFSET pagination to cut the cost. ## Quick Start Ask the AI to analyze your database queries for excessive data transfer and fix the query patterns driving up your Postgres egress costs.

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 find which Postgres queries cause high egress costs?▼

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 or called extremely often are the biggest egress contributors.

How to reduce Neon database data transfer costs?▼

Reduce Neon transfer costs by selecting only needed columns instead of SELECT *, adding LIMIT/OFFSET pagination, pushing aggregation into SQL, splitting wide JOINs into separate queries, and caching frequently accessed static data.

Why is my Postgres bill so high even with a small database?▼

High bills with small databases usually come from unpaginated endpoints, JOINs duplicating wide parent columns across child rows, or queries called thousands of times daily. Egress scales with data transferred, not data stored.

Does pg_stat_statements work on Neon Postgres?▼

Yes, pg_stat_statements is available on Neon by default but may require running CREATE EXTENSION IF NOT EXISTS pg_stat_statements. Note that stats reset when a Neon compute scales to zero and restarts.

When should I split a JOIN into two queries?▼

Split a JOIN when a wide parent table joins a child table with many rows, since parent columns repeat across every child row. Two separate queries fetch each dataset once, eliminating duplicated transfer.