# Postgres Hosting with Database Branching | Volcano

URL: https://volcano.dev/features/postgres

> Branch Postgres for every pull request. Test migrations on your data, query with row-level security, and use pgvector for AI retrieval.

## Branch your Postgres per pull request

Give each pull request its own branch of your real data, usually ready in under a minute.

Image: The Volcano dashboard listing a project's databases.

## Managed Postgres you can branch

Try a migration on real rows without touching production.

- **Branches**: Each branch is a copy-on-write fork with its own connection string.
- **Row-level security**: Policies decide what each user's query sees.
- **Autoscaling**: Compute scales with load inside your chosen tier.

Image: The Volcano dashboard listing databases with their region, Postgres version and tier.

## What you need

- **A Volcano account**: Sign up from the CLI.
- **Volcano CLI**: Install with npm.
- **Any Postgres client**: psql, a driver or an ORM.

## Try it

### 1. Create a database

PostgreSQL 16, 17 or 18, reachable over TLS.

bash

```bash
volcano login
volcano cloud databases create app
```

### 2. Add a table and a policy

Apply with volcano cloud databases migration up -d app --all.

One statement per file in volcano/migrations/

```sql
create table if not exists notes (id uuid primary key default gen_random_uuid(), user_id uuid default auth.uid(), title text);
alter table notes enable row level security;
drop policy if exists own_notes on notes;
create policy own_notes on notes using (user_id = auth.uid());
```

### 3. Branch it for a pull request

The branch gets its own connection string and expires on its own.

bash

```bash
volcano cloud databases branches create app pr_482 --ttl 72h
volcano cloud databases branches get app pr_482 --show-connection-string
```

## Check it works

- Write to the branch. The parent database doesn't change.
- Query signed in, then signed out. Each sees only the rows your policies allow.
- After the branch expires, its connection string stops working.

## Works with

- [Authentication](https://volcano.dev/features/authentication): Policies read the signed-in user.
- [Realtime](https://volcano.dev/features/realtime): Stream row changes to the browser.
- [Functions](https://volcano.dev/features/edge-functions): Query from server code.
- [Next.js frontends](https://volcano.dev/features/nextjs-hosting): Read and write tables from client components.

## Frequently asked questions

### Can I use my existing Postgres tools with Volcano?

Yes. Volcano runs PostgreSQL 16, 17 or 18 on port 5432 over TLS. Connect with psql, pg\_dump, Prisma, Sequelize, TypeORM or any Postgres driver.

### Can I use pgvector for AI retrieval?

Yes. Run CREATE EXTENSION IF NOT EXISTS vector, add a vector column and an index, and search embeddings in SQL under your row-level policies.

### How many Postgres database branches can I create?

Up to 10 per database on Hobby and 25 on Superagent. Each is usually ready in under a minute and expires when you choose.

## Get started

Build with Databases and vector. Create a free account at https://volcano.dev/signup, or have your coding agent follow the setup playbook at https://volcano.dev/setup.md.
