GLOSSARY

What is a database sandbox?

A database sandbox is an isolated database environment where developers or AI agents can safely test changes, run experiments, and validate queries without affecting production. Modern sandboxes use copy-on-write branching to create production-identical copies in seconds rather than maintaining separate staging environments.

HOW IT WORKS

How database sandbox works

Traditional database sandboxes are created by restoring a backup into a separate database instance. This process takes hours for large databases, requires dedicated compute and storage, and the sandbox data begins drifting from production the moment it's created.

Modern database sandboxes use copy-on-write branching to solve these problems. When you create a sandbox, the branching engine creates a new database reference that shares storage pages with production. The sandbox has the same schemas, data, indexes, and constraints — but is completely isolated.

Write operations on the sandbox only copy the modified pages, so storage costs scale with changes rather than database size. Compute is provisioned independently, so sandbox queries don't affect production performance.

Each sandbox gets its own Postgres connection string. Connect any tool — psql, application code, AI agents, migration frameworks — and work as if it were the real database. When done, delete the sandbox and reclaim all resources.

WHY IT MATTERS

Why database sandbox matters

Database sandboxes are becoming critical as AI coding agents enter the development workflow. Tools like Claude Code, Cursor, and GitHub Copilot can generate SQL, write migrations, and modify data — but they need a safe environment with real data to produce accurate results.

Without sandboxes, teams face a dilemma: give AI agents access to production (dangerous) or give them empty test databases (useless for catching real bugs). A sandbox with production-identical data is the solution — the agent works on real data with zero risk.

Sandboxes also eliminate the shared staging environment problem. When multiple developers share a staging database, they step on each other's changes. With per-developer sandboxes that create in seconds, every developer gets their own isolated copy. No conflicts, no coordination, no waiting.

EXAMPLE

database sandbox in practice

# Create a sandbox for testing a data cleanup
$ ardent branch create sandbox-cleanup
✓ Branch created in 4.8s
postgres://branch-sand01.db.tryardent.com:5432/mydb

# Connect and experiment freely
$ psql postgres://branch-sand01.db.tryardent.com:5432/mydb

DELETE FROM orders WHERE status = 'cancelled'
  AND created_at < '2024-01-01';
-- 23,847 rows deleted (only on sandbox)

SELECT count(*) FROM orders;
-- 1,203,456 (vs 1,227,303 in production)

# Review what changed
$ ardent branch diff
# Shows every deleted row across all tables

# Done? Just delete the sandbox
$ ardent branch delete sandbox-cleanup

The sandbox workflow is simple: create, experiment, review, delete. No persistent infrastructure to maintain, no data to sync, no cleanup scripts to run.

RELATED CONCEPTS

Related terms

Database Branching
Copy-on-Write
Ephemeral Environments
Change Data Capture
FAQ

Frequently asked questions

What is a database sandbox?

An isolated database environment for testing and experimentation. Modern sandboxes use copy-on-write branching to provide production-identical copies in seconds.

How is a sandbox different from staging?

Staging is shared, persistent, and drifts from production. Sandboxes are disposable, per-task, and contain production-identical data via branching.

Is it safe for AI agents to use sandboxes?

Yes. Sandboxes are fully isolated at compute and storage layers. AI agents can run any operation — including destructive ones — with zero risk to production.

Try database sandbox with Ardent

Create isolated database branches in under 6 seconds. No risk to production.

Read the docsBook a demo