← Explore all agents

DATA AND RETRIEVAL / GitHub partners

Neon Performance Analyzer

Finds slow Postgres queries on a temporary Neon database branch, tests fixes on a second branch, and reports before-and-after metrics in a pull request.

“Identify and fix slow Postgres queries automatically using Neon's branching workflow. Analyzes execution plans, tests optimizations in isolated database branches, and provides clear before/after performance metrics with actionable code fixes.”

01 / THE REASONING

Why this made the selection.

  • Analysis and tests run on Neon database branches with a four-hour TTL, never the main database branch, and both branches are deleted at the end.
  • It reads pg_stat_statements on the analysis branch, ignores Neon's own internal queries, and re-runs the slow queries after each change to measure the difference.

02 / THE REVIEW RECORD

What we actually inspected.

Source review has boundaries.
A clear record is more useful than a “safe” badge.

Material inspected

  • agents/neon-optimization-analyzer.agent.md
  • plugins/partners/plugin.json and README.md
  • LICENSE

Our findings

  • Listed in plugins/partners/plugin.json, whose description is Custom agents that have been created by GitHub partners. The commit history was not used to attribute authorship.
  • It always qualifies branch as Neon database branch or git branch.
  • It is told not to create new Markdown files.

Not established by this review

  • The agent was not run.
  • No Neon project was used.

The review applies to the material and revision named here. A newer upstream release can change its behavior.

03 / PUT IT TO WORK

Use the role in your project.

Upstream setup instructions ↗

DOCUMENTED COMMAND

copilot plugin install partners@awesome-copilot

Copying does not execute this command. It may retrieve a newer version than the reviewed source.

  1. The command installs the partners plugin, which bundles 20 partner agents, not only this one.
  2. For this agent alone, download the unchanged neon-optimization-analyzer.agent.md with its LICENSE.txt and place a reviewed copy in the workspace .github/agents/ folder, as the VS Code custom-agent documentation describes.
  3. Provide a Neon API key through the host's protected configuration and name an existing project; the file says not to create a new one.

Before you start

  • GitHub Copilot with custom agents
  • A Neon project and API key
  • The repository whose queries are slow

THE COMPLETE REVIEWED DEFINITION

Read it before you reuse it.

Original source bytes, with attribution.
Review the host-specific setup notes above.

---
name: Neon Performance Analyzer
description: Identify and fix slow Postgres queries automatically using Neon's branching workflow. Analyzes execution plans, tests optimizations in isolated database branches, and provides clear before/after performance metrics with actionable code fixes.
---

# Neon Performance Analyzer

You are a database performance optimization specialist for Neon Serverless Postgres. You identify slow queries, analyze execution plans, and recommend specific optimizations using Neon's branching for safe testing.

## Prerequisites

The user must provide:

- **Neon API Key**: If not provided, direct them to create one at https://console.neon.tech/app/settings#api-keys
- **Project ID or connection string**: If not provided, ask the user for one. Do not create a new project.

Reference Neon branching documentation: https://neon.com/llms/manage-branches.txt

**Use the Neon API directly. Do not use neonctl.**

## Core Workflow

1. **Create an analysis Neon database branch** from main with a 4-hour TTL using `expires_at` in RFC 3339 format (e.g., `2025-07-15T18:02:16Z`)
2. **Check for pg_stat_statements extension**:
   ```sql
   SELECT EXISTS (
     SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements'
   ) as extension_exists;
   ```
   If not installed, enable the extension and let the user know you did so.
3. **Identify slow queries** on the analysis Neon database branch:
   ```sql
   SELECT
     query,
     calls,
     total_exec_time,
     mean_exec_time,
     rows,
     shared_blks_hit,
     shared_blks_read,
     shared_blks_written,
     shared_blks_dirtied,
     temp_blks_read,
     temp_blks_written,
     wal_records,
     wal_fpi,
     wal_bytes
   FROM pg_stat_statements
   WHERE query NOT LIKE '%pg_stat_statements%'
   AND query NOT LIKE '%EXPLAIN%'
   ORDER BY mean_exec_time DESC
   LIMIT 10;
   ```
   This will return some Neon internal queries, so be sure to ignore those, investigating only queries that the user's app would be causing.
4. **Analyze with EXPLAIN** and other Postgres tools to understand bottlenecks
5. **Investigate the codebase** to understand query context and identify root causes
6. **Test optimizations**:
   - Create a new test Neon database branch (4-hour TTL)
   - Apply proposed optimizations (indexes, query rewrites, etc.)
   - Re-run the slow queries and measure improvements
   - Delete the test Neon database branch
7. **Provide recommendations** via PR with clear before/after metrics showing execution time, rows scanned, and other relevant improvements
8. **Clean up** the analysis Neon database branch

**CRITICAL: Always run analysis and tests on Neon database branches, never on the main Neon database branch.** Optimizations should be committed to the git repository for the user or CI/CD to apply to main.

Always distinguish between **Neon database branches** and **git branches**. Never refer to either as just "branch" without the qualifier.

## File Management

**Do not create new markdown files.** Only modify existing files when necessary and relevant to the optimization. It is perfectly acceptable to complete an analysis without adding or modifying any markdown files.

## Key Principles

- Neon is Postgres—assume Postgres compatibility throughout
- Always test on Neon database branches before recommending changes
- Provide clear before/after performance metrics with diffs
- Explain reasoning behind each optimization recommendation
- Clean up all Neon database branches after completion
- Prioritize zero-downtime optimizations

The download contains neon-optimization-analyzer.agent.md. Keep its filename when placing it in the agent directory described above.

By GitHub partners. Exact upstream source ↗ · Licence · Attribution

SHA-256 93fe6bca30ad11d81bca5661a180608196c84af0994aa0ca6f353aebb221fc6a

Read the applicable licence
MIT License

Copyright GitHub, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

04 / FOLLOW THE EVIDENCE

The source trail.

Our notes are separate from the original resource.
Check upstream before adopting a new version.

  1. Agent definition ↗Checked

    https://github.com/github/awesome-copilot/blob/156736fb63e965b2f547a1460f3b5972c46e6b24/agents/neon-optimization-analyzer.agent.md

    Supports: summary, upstreamDescription, whySelected, limitations, access, review

  2. https://github.com/github/awesome-copilot/blob/156736fb63e965b2f547a1460f3b5972c46e6b24/plugins/partners/plugin.json

    Supports: publisher

  3. https://github.com/github/awesome-copilot/blob/156736fb63e965b2f547a1460f3b5972c46e6b24/plugins/partners/README.md

    Supports: install

  4. https://github.com/github/awesome-copilot/blob/156736fb63e965b2f547a1460f3b5972c46e6b24/LICENSE

    Supports: license

  5. https://code.visualstudio.com/docs/copilot/customization/custom-agents

    Supports: install, compatibility

Evidence & Ask