skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

neon-postgres-egress-optimizer

Optimize Neon Postgres egress and data transfer

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/neondatabase/agent-skills --skill neon-postgres-egress-optimizer

Overview

What This Skill Does

Diagnoses and fixes Postgres query patterns that cause excessive data transfer from a database to an application. Works by analyzing pg_stat_statements output to find queries returning too many rows, too many columns, or running too frequently. Covers SELECT * abuse, missing pagination, JOIN duplication, and application-side aggregation.

Application

When to use this Skill

Documentation

Show Skills.md file

Postgres Egress Optimizer

Guide the user through diagnosing and fixing application-side query patterns that cause excessive data transfer (egress) from their Postgres database. Most high egress bills come from the application fetching more data than it uses.

Step 1: Diagnose

Identify which queries transfer the most data. The primary tool is the pg_stat_statements extension.

Check if pg_stat_statements is available

SELECT 1 FROM pg_stat_statements LIMIT 1;

If this errors, the extension needs to be created:

CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

On Neon, it is available by default but may need this CREATE EXTENSION step.

Handle empty stats

Stats are cleared when a Neon compute scales to zero and restarts. If the stats are empty or the compute recently woke up:

Lines 1 - 25 of 199

Recommendations

Explore other random skills

All skillsMy patterns