Xata’s Scale to Zero feature allows you to minimize costs by hibernating database branches during periods of inactivity. This is particularly useful for development, testing and staging environments that don’t need to be active 24/7.When a branch is hibernated:
Compute is paused and no active database connections are allowed
Your data remains safe and accessible
You only pay for storage, not compute costs
Branches can be reactivated immediately
Xata offers two different ways of implementing scale to zero for your branches.
Manual hibernation
Automatic scale to zero
At the moment, you can enable either manual hibernation or scale to zero, but not both simultaneously.
Go to the Compute section under Branch Settings in the Xata Console
Toggle “Hibernate branch” to “off”
Click “Save compute settings”
The branch will immediately start accepting connections
Alternatively you can click the “Wake up branch” button in the branch overview to wake up a Hibernated Branch. You can also use the “Wake up branch” button available in the Queries, Extensions and Schemas tabs.
Automatic scale to zero allows you to hibernate a branch after a configurable period of inactivity and automatically reactivate it when you attempt to connect to it.
You can configure your scale to zero settings at the project level:
Go to the Compute section under Project Settings in the Xata Console
Toggle “Enable for base branch” if you want to enable scale to zero for your base branch by default
Toggle “Enable for child branches” if you want to enable scale to zero for child branches by default
Configure the relevant inactivity period for base/child branches
Click “Save settings”
The project scale to zero settings will be the default when creating new branches within the project. However, you will also be prompted at branch creation time in case you want to update those settings on a per branch basis. By default, these project level settings are only applied to new branches. If you would like existing branches to also be affected by these settings, you can check the “Apply these settings to existing branches” box.Alternatively, you can also update the scale to zero settings once the branch has been created:
Go to the Compute section under Branch Settings in the Xata Console
Toggle “Scale to Zero” to enabled
Configure the inactivity period for the branch (default to 30min)
Click “Save compute settings”
The branch will now start tracking the open connections, and will automatically scale to zero once the configured period of inactivity has passed.
It is possible to create a child branch from a hibernated base branch (regardless of it being manually hibernated or scaled to zero). The base branch will not be woken up, keeping the costs to a minimum during the branching process.