Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 12 min read How-to mediumAdept

How to reduce Postgres compute costs as you scale

Compute, not storage, usually dominates managed Postgres bills, and allocation-based services like Amazon RDS leave most provisioned capacity idle. On RDS, costs fall through careful planning of instance count, multi-AZ use and instance size, through downsizing guided by CloudWatch metrics such as CPUUtilization and FreeableMemory, and through query tuning: EXPLAIN ANALYZE, indexes, materialized views, caching and fixing ORM N+1 queries. Manual resizing is slow, error-prone and causes downtime, so Neon positions its autoscaling (autoscaler-agent, a modified Kubernetes scheduler and NeonVM) and scale-to-zero autosuspend as the way to make compute spend track actual load.

Related posts

  • Neon Compute Autoscaling Report

    Neon mediumAdept

    Neon's December 2025 fleet data shows production Postgres databases using 2.4x less compute and about 50% lower cost than they would if sized for a provisioned platform using AWS RDS's rightsizing rule (P99.5 utilization + 20%). Even that provisioning level would leave the average production database exhausting resources about 55 times a month. Read replicas, which share storage with the primary and autoscale independently, use 4x less compute. Small scale-to-zero databases cost 7.5x less than running them continuously. The methodology section covers workload classification, how P99.5 sizing and incident counts were derived from autoscaling histories, the provisioned per-CU-hour rates assumed, and why cost savings trail compute savings.

  • Neon Autoscaling is Generally Available

    Neon easyNovice

    Neon's Postgres autoscaling is now generally available on all plans, including Free (up to 2 CPU, 8 GB RAM), adjusting CPU and memory to load between user-set minimum and maximum limits, with scale-to-zero. Each Postgres instance runs in its own VM managed inside Kubernetes by NeonVM, which supports live migration. A per-node autoscaler-agent checks metrics every 5 seconds, and a modified scheduler must pre-approve every upscale. Memory scaling moved from unstable cgroup memory.high signals to polling every 100ms, with swap added for bursty allocations. A resizable local file cache extends shared buffers and feeds scaling decisions. The recommended setup is a high limit with scale-to-zero disabled for production, and a low limit with scale-to-zero enabled for dev branches.

  • Scaling serverless Postgres: How we implement autoscaling

    Neon mediumAdept

    Neon autoscales serverless Postgres by running each compute endpoint in a QEMU/KVM VM on Kubernetes (via its NeonVM controller) and hot-adding or removing CPU and memory based on load average. A per-node autoscaler-agent makes scaling decisions but must get every upscale approved by a modified Kubernetes scheduler plugin, which acts as the single source of truth to prevent memory overcommit. Post-copy live migration (~100ms pauses) moves VMs off full nodes, kept cheap by separated storage. Inside each VM, a vm-informant uses cgroup memory.high notifications to freeze Postgres briefly (up to 20ms) while requesting more memory, and resizes a tmpfs-backed local file cache with 1MB LRU chunks that gave one user a 4x speedup.

  • Autoscaling Lakebase Postgres

    Neon hardMaster

    Neon's Lakebase Postgres resizes compute in place about once every 81 seconds by taking the maximum of three target sizes: CPU load (one-minute average kept under 90%), memory (polled every 100 ms by an in-VM monitor and kept under 75%), and the working set of the compute cache. The working set comes from a modified HyperLogLog that stores timestamps instead of bits, so it can estimate distinct pages for any window from 1 to 60 minutes. The algorithm then looks for a jump in that curve to find where the current workload ends, and projects growth forward to the next 20-second interval. Resizes are applied to running QEMU/KVM VMs via NeonVM, with a modified Kubernetes scheduler approving upscales, live migration when a node is full, and in-VM checks before any downscale.

  • How to Make the Most of Neon’s Free Plan

    Neon mediumAdept

    Neon's Free Plan limits apply per project rather than per account, so usage has to be monitored on each project's dashboard. Compute is metered as CU-hours (CU size × hours run), which means smaller compute sizes stretch run time: 0.25 CU gives 400 hours from a 100 CU-hour allowance. Scale-to-zero only saves compute if the connection method actually lets the database go idle. Storage stays in check through retention policies, dropping unused indexes, autovacuum or pg_repack for dead tuples, and archiving. Egress drops when queries avoid returning rows after UPDATE/DELETE, select only needed columns, and ORM defaults are reviewed.

The quest for software engineering knowledge.

Look:
Layout: