Using Replit Agent? Learn how to add a configured Postgres database to your apps with a single prompt
Docs/Features/Scale to zero/Scale to zero guide

Configuring Scale to Zero for Neon computes

Learn how to configure Neon's Scale to Zero feature

Neon's Scale to Zero feature controls whether a Neon compute transitions to an idle state due to inactivity. For example, if scale to zero is enabled, your compute will transition to an idle state after it's been inactive for 5 minutes. Neon's paid plans allow you to disable scale to zero to keep your compute active.

important

If you disable scale to zero entirely, your compute will remain active, and you will have to manually restart your compute to pick up the latest updates to Neon's compute images. Neon typically releases compute-related updates weekly. Not all releases contain critical updates, but a weekly compute restart is recommended to ensure that you do not miss anything important. For how to restart a compute, see Restart a compute.

This guide demonstrates how to configure the scale to zero setting for a new project, for an existing project, or for an individual compute.

Scale to zero limits

The scale to zero limit is the same on each Neon plan, but paid plans permit disabling scale to zero.

PlanScale to zero afterCan be disabled?
Free Plan5 minutes
Launch5 minutes
Scale5 minutes
Business5 minutes
Enterprise5 minutes

Configure scale to zero for a compute

To configure the scale to zero setting for an individual compute:

  1. In the Neon Console, select Branches.
  2. Select a branch.
  3. On the Computes tab, click Edit.
  4. Specify your scale to zero setting.
  5. Click Save.

Configure the scale to zero default

Configuring the scale to zero setting in your project's settings sets the project's default, which is applied to all computes created from that point forward. Existing compute scale to zero settings are unaffected.

To configure the scale to zero default for an existing project:

  1. Select a project in the Neon Console.
  2. On the Neon Dashboard, select Settings.
  3. Select Compute and click Change.
  4. Specify your scale to zero setting.
  5. Click Save.

Monitor scale to zero

You can monitor scale to zero on the Branches page in the Neon Console. A compute reports either an Active or Idle status.

Compute status

You can also view compute state transitions in the Branches widget on the Neon Dashboard.

User actions that activate an idle compute include connecting from a client such as psql, running a query on your database from the Neon SQL Editor, or accessing the compute via the Neon API.

info

The Neon API includes a Start endpoint method for the specific purpose of activating and suspending a compute.

You can try any of these methods and watch the status of your compute as it transitions from an Idle to an Active state.

Session context considerations

When a compute suspends and later restarts, the session context resets. This includes in-memory statistics, temporary tables, prepared statements, and autovacuum thresholds, among other session-specific data. If your workflow requires persistent session data, consider disabling scale to zero on a paid plan to keep your compute active continuously. On the Free plan, scale to zero is always enabled and automatically suspends your compute after 5 minutes of inactivity.

Last updated on

Was this page helpful?