---
title: "Zero downtime schema changes for PostgreSQL"
description: "Apply schema changes directly in production without downtime or complex rollbacks. Ideal for teams operating in high-availability environments."
source: "https://xata.io/postgres-schema-changes"
---

Zero-downtime
schema changes for PostgreSQL
=============================

Update your PostgreSQL schema online and with safe rollbacks.

[Get started](https://console.xata.io/signup)

## Take the fear out of schema changes

Downtime, table locking, and rollback complexity are common risks with traditional schema changes tools. Our unique approach solves these problems.

### The challenges you're facing

- **Locking tables during migrations.** Large tables can be locked for long periods of time, causing downtime.
- **Limited deployment windows.** Changes often need to wait for off-peak hours, slowing down iteration.
- **Rollback risk.** Rolling back migrations is often left untested, and is error-prone.
- **Complex development workflows.** Performing schema changes safely requires multiple manual steps and multiple pull requests.

### How Xata solves them

- **Safe by default.** All schema changes are safe and guaranteed to not lock tables for a long time.
- **Online schema migrations.** High level schema changes operations are performed online, without downtime.
- **Instant and safe rollbacks.** Rolling back migrations means simply dropping the views and temporary objects.
- **Simple workflow via multi-version views.** The old and the new schema are available at the same time, which greatly simplifies the schema change workflow.

Open source

## Powered by pgroll

pgroll is our popular open source tool that enables zero-downtime, fully reversible schema changes for PostgreSQL.

### Multi-version schemas

pgroll uses PostgreSQL views to present two versions of the schema at the same time. This means you don't need multiple steps or temporary code for backwards compatibility.

### Expand-contract pattern

pgroll automates the expand-and-contract pattern, handling the complex steps of schema changes for you. Hidden columns are added during the expand step, and removed during the contract step.

### Automated data backfills

Automates data backfills and data conversion and/or data manipulation, so that you don't need one-time scripts to do it. pgroll streamlines multi-step migrations into a single consistent workflow.

## Simplify your schema changes workflow

You can use the Xata CLI to easily create and switch database branches during development and to integrate Xata into your CI/CD.

## A complete solution for PostgreSQL

Xata is the only solution on the market that offers a complete developer workflow for PostgreSQL. This includes instant development branches as well as merging back: apply the schema changes to production with zero-downtime.

Keep your production database where it is, whether it is AWS RDS, Aurora, GCP Cloud SQL, Azure Database, or even self-hosted.

Mask sensitive data using configurable transformers that maintain referential integrity.

[Learn more](/postgres-data-masking)

Get a nightly synced replica of production with sensitive data removed. Ready for testing.

[Learn more](/realistic-staging-dev)

From the staging environment, instantly create Copy-on-Write branches for each pull request to accelerate development, testing, and collaboration.

[Learn more](/postgres-branching)

Apply database changes confidently with pgroll, serving old and new schema versions in parallel for smooth, lock-free migrations.

## Branch your database in seconds

[Get in touch](https://cal.com/team/xata/xata-sales)[Get started](https://console.xata.io/signup)
