PrismSQL BRANCHABLE POSTGRES
ISSUE 04 // COPY-ON-WRITE POSTGRES ARCHITECTURE PG-17.2 // COW-PAGESERVER
PrismSQL optical refraction monolith representing copy-on-write Postgres database branches
PLATE 01 LSN 0/8B42F190

Zero-Copy Storage Topology

Immutable 8 KB page trees shared instantaneously across unlimited pull-request environments.

Shared Base Pages: 99.66% Active CoW Tree

Branchable Postgres for CI & Preview Envs

Copy-on-write database branches spun up per pull request.

Fork multi-terabyte PostgreSQL databases in 380 milliseconds with zero duplicate storage. Every pull request receives an isolated, production-faithful Postgres branch that scales to zero when tests finish.

Verified Production Telemetry

Median Branch Fork
Constant time at 8 TB
380 ms
Copy-on-Write Delta
Shared immutable 8 KB pages
0.34%
PostgreSQL Engine
100% native wire protocol
17.2
Idle Preview Cost
Auto-suspend in 60s
$0.00

Signature Inspector

Branch Storage & Snapshot Diff

Production Base Footprint 2,000 GB

Active Ephemeral Branches

Fork Latency

362 ms

Storage Saved

99.99%

Diverged 8K Pages

1,840 pages

Parent LSN

0/8B42F190

DDL / Snapshot Delta 3 tables touched
+ ALTER TABLE ledger_postings
+   ADD COLUMN idempotency_hash bytea NOT NULL;
+ CREATE UNIQUE INDEX CONCURRENTLY idx_postings_idem
+   ON ledger_postings (tenant_id, idempotency_hash);

Zero lock contention on main; tested against 42M anonymized billing rows.

Git-Native Database Lifecycle

Treat terabyte databases like lightweight Git branches.

Inspect all 9 platform modules →
STG-01 · Storage Engine 8 KB page granularity

Log-Structured Copy-on-Write Pageserver

Separates stateless Postgres compute from a multi-tenant page store backed by NVMe tiers and immutable object storage.

Zero-copy fork WAL replay S3 cold tier
CI-02 · CI & Previews Auto-prune on merge

GitHub & GitLab Pull-Request Lifecycle

Creates a fresh database branch on PR open, injects DATABASE_URL into preview builds, and tears down cleanly on close.

GitHub Action Vercel / Fly sync Schema drift check
BRN-03 · Branching 30-day WAL window

Sub-Second LSN Point-in-Time Branching

Spawn a read-write branch from any historical timestamp or WAL LSN to inspect incidents or extract deleted rows safely.

Exact LSN pin Non-destructive Audit trail
STG-04 · Storage Engine 240 ms cold wake

Sub-Second Scale-to-Zero Compute

Suspends idle preview branch compute automatically after 60 seconds while preserving connection pool state at the proxy.

Connection hold PgBouncer native 94% idle savings
SEC-05 · Security SOC2 Type II

Deterministic Branch Anonymization

Applies declarative masking rules on branch materialization so engineers test real data shapes with zero production PII.

Column redaction Synthetic emails RBAC scoped
BRN-06 · Branching Detects table locks

Structural Migration & Lock Analyzer

Compares branch catalog metadata against main and flags blocking ALTER TABLE rewrites before code review completes.

AST diff Lock timeout lint PR comment bot

One-Line GitHub Action

Eliminate flaky shared staging databases forever.

Every pull request runs migrations and Playwright suites against a dedicated copy-on-write snapshot of production schema and masked cardinality—never waiting on pg_restore again.

Read CI Integration Guide
# .github/workflows/preview-db.yml
- name: Fork isolated Postgres branch
  uses: prismsql/branch-action@v3
  with:
    parent: main
    branch: pr-${{ github.event.pull_request.number }}
    masking_policy: pii-safe-v2
    auto_suspend_seconds: 60