Overview
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
- Manual hibernation
- Automatic scale to zero
Manual Hibernation
Currently, you can manually hibernate branches through the Xata Console:How to Hibernate a Branch
- Go to the Compute section under Branch Settings in the Xata Console
- Toggle “Hibernate branch” to enabled
- Click “Save compute settings”
Hibernation Status
You can monitor hibernation status in the Xata Console:- Active branches are running and accepting connections
- Hibernated branches are paused and not accepting connections
Waking Up a Manually Hibernated Branch
To reactivate a hibernated branch:- 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
Automatic Scale to Zero
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.How to Enable Scale to Zero for a Branch
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”
- 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.
Waking Up a Scaled to Zero Branch
A branch that has been automatically scaled to zero can be reactivated:- By opening a connection to the branch (ex. connecting to the branch via psql)
- Manually, by clicking on the “Wake up branch” icon that appears on the branch overview or any other branch tabs that allow it.
Branching off a Hibernated Branch
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.When to use Scale to Zero
Development Branches
Perfect for feature branches that are only used during active development:- You can hibernate branches when not actively developing
- Branches wake up instantly when you start working
- This reduces costs for long-running feature development
Staging Environments
Ideal for staging databases that mirror production:- You can hibernate staging environments when not testing
- Branches wake up for deployment testing
- This maintains production-like data without 24/7 costs
Testing Environments
Great for automated testing databases:- You can hibernate between test runs
- Branches wake up for CI/CD pipelines
- This optimizes costs for comprehensive testing