---
title: "Performance tips for Neon Postgres"
description: "Neon's serverless Postgres follows mostly standard Postgres tuning, plus a few Neon-specific checks."
url: "https://swe.quest/articles/performance-tips-for-neon-postgres-9739985c47432424"
canonical: "https://neon.com/blog/performance-tips-for-neon-postgres"
source: "Neon"
published: "2024-04-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["postgres","performance","serverless","sql"]
---

# Performance tips for Neon Postgres

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-04-04, 8 min read, How-to. Original: [https://neon.com/blog/performance-tips-for-neon-postgres](https://neon.com/blog/performance-tips-for-neon-postgres)

## Summary

Neon's serverless Postgres follows mostly standard Postgres tuning, plus a few Neon-specific checks. Size compute at roughly 100 connections per GB of RAM, use pooling and autoscaling, then find slow queries with pg\_stat\_statements and EXPLAIN (ANALYZE, BUFFERS). Fix them with indexes, REINDEX and autovacuum tuning against bloat, and by keeping the local file cache hit ratio (shown in neon\_stat\_file\_cache) above 99%. For faster ingests, batch inserts, drop unused indexes, offload reads to ephemeral read replicas, and test changes safely on a database branch.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- Postgres indexes ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

Neon, pg\_stat\_statements, EXPLAIN ANALYZE, autovacuum, pgstattuple, neon\_stat\_file\_cache, neonctl

## Related posts

- [Postgres Support Recap: Investigating Postgres Query Performance](https://swe.quest/articles/postgres-support-recap-investigating-postgres-query-performance-82d2d3f876d71410.md): Neon · 2024-02-29 · Medium · 9 min read · PostgreSQL, Performance engineering, SQL, Observability
  Three starting points for diagnosing slow Postgres queries: use pg\_stat\_statements to find long-running queries by mean execution time and then EXPLAIN ANALYZE them, check the cache hit ratio (in Neon via the neon\_stat\_file\_cache view, since Neon extends shared buffers with a local file cache), and look for table and index bloat caused by MVCC dead tuples.
- [Debug your Postgres from the terminal: a tour of \`neon inspect db\`](https://swe.quest/articles/debug-your-postgres-from-the-terminal-a-tour-of-neon-inspect-db-388ae9813e34917e.md): Neon · 2026-07-22 · Medium · 10 min read · PostgreSQL, Observability, Developer tools, Performance engineering, Replication
  \`neon inspect db\` adds fourteen read-only Postgres diagnostic subcommands to the Neon CLI, each running one curated query against Postgres statistics and catalog views (table/index sizes, bloat, unused indexes, seq scans, long-running queries, locks, pg\_stat\_statements outliers and calls, vacuum stats, replication slots, subscriptions).
- [Dynamically estimating and scaling Postgres’ working set size](https://swe.quest/articles/dynamically-estimating-and-scaling-postgres-working-set-size-9625ea29ef0bf2ef.md): Neon · 2024-09-05 · Medium · 12 min read · PostgreSQL, Algorithms, Capacity planning, Caching, Serverless
  Neon autoscales Postgres compute to keep the workload's working set in memory, using a modified HyperLogLog whose register bits are replaced with timestamps so the number of distinct pages accessed can be estimated for any lookback window.
- [Autoscaling in Action: Postgres Load Testing with pgbench](https://swe.quest/articles/autoscaling-in-action-postgres-load-testing-with-pgbench-9e7339241ec6e0af.md): Neon · 2024-02-23 · Medium · 5 min read · PostgreSQL, Capacity planning, Performance engineering, Serverless
  A pgbench load test against Neon serverless Postgres runs a CPU-heavy query, SELECT log(factorial(32000)) / log(factorial(20000)), to trigger autoscaling.
- [6 tips to optimize storage costs for your Postgres databases](https://swe.quest/articles/6-tips-to-optimize-storage-costs-for-your-postgres-databases-11da5e875c34786c.md): Neon · 2024-03-15 · Medium · 4 min read · PostgreSQL, Cost optimization, Storage engines
  Six ways to shrink Postgres storage spend: drop unused indexes (found via pg\_stat\_user\_indexes and pg\_index), avoid full database copies for dev and staging by using Neon's copy-on-write branching, choose smaller data types like SMALLINT, order columns largest to smallest to cut alignment padding, shorten Neon's history retention window, and tune autovacuum to limit bloat.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
