This page covers PlanetScale for Postgres. For PlanetScale on Vitess (MySQL), use the PlanetScale source connector.
Create a service account
Connect to the primary as the branch’s defaultpostgres role on port 5432 and run:
setup.sql
- Connect as
artie_transfer.<branch_id>. The branch ID is the part after the.in the default username (e.g.postgres.nk35mx55qq). - SQL-created roles don’t appear on the PlanetScale Roles page. A managed role can only get WITH REPLICATION by inheriting
postgres(admin), so this role is the least-privileged option.
Create the heartbeat table
Heartbeats keep the slot advancing on a quiet branch, which matters on PlanetScale becausemax_slot_wal_keep_size defaults to no limit. As postgres, run:
heartbeats.sql
artie_transfer without the branch suffix. The table must be in the publication, which the next step covers. Then turn on Enable heartbeats under Postgres settings.
Create a publication
Artie can’t create publications on PlanetScale, so create one aspostgres. Without it, deployment fails with publication "dbz_publication" does not exist.
Once a table is in a publication, PostgreSQL rejects UPDATE and DELETE on it unless it has a primary key or replica identity. First, list tables that would break:
check.sql
REPLICA IDENTITY FULL on each (details) or publish only specific tables (below). To replicate a table without a primary key, also set Override primary keys in Artie to an existing unique index, or Artie fails with partition key is not set. Then create the publication and leave the pipeline’s publication mode on All tables:
publication.sql
Publish only specific tables
Publish only specific tables
Create the publication with a table list instead, and include the heartbeat table if you use heartbeats:Set the pipeline’s publication mode to Filtered. If you already created the
FOR ALL TABLES publication, drop it first (DROP PUBLICATION dbz_publication;), or deployment fails with please set the publication mode to 'all tables'. Add new tables before adding them to the pipeline:Enable logical replication
In the PlanetScale console, go to your branch’s Clusters → Parameters and set:Create a failover-safe replication slot
A slot only survives a PlanetScale switchover or failover if it hasfailover = true. If PlanetScale finds a logical slot without it, it notifies you and resumes planned failovers after three days.
Before you deploy, enable Use PostgreSQL 17 failover replication slot under Postgres settings. Artie then creates its slot with failover. The setting doesn’t change an existing slot.
Create the slot yourself
Create the slot yourself
As Use your slot name override instead of
artie_transfer, before deploying:slot.sql
artie if you set one. Keep the failover setting on so Artie recreates the slot with failover if it’s ever dropped.failover is t:
f, see Repairing a slot created without failover below.
Connect Artie to PlanetScale
Artie enables TLS automatically, which PlanetScale requires. Under Postgres settings, turn on Publish partitioned table changes via partition root to match the publication, or deployment fails validation.
Advanced
Repairing a slot created without failover
Repairing a slot created without failover
You can enable failover on an existing slot without dropping it (PlanetScale’s procedure). If it hangs, a session is still attached. From a normal (non-replication)
sync_replication_slots and hot_standby_feedback must be on first.1
Pause the pipeline
Choose Pause reading & delivery so the reader releases the slot (the default, Pause delivery only, stays connected). For a shared source reader, contact Artie support to pause it.
2
Open a replication connection as the default role
3
Alter the slot
postgres connection, run:4
Verify and resume
Confirm
failover is t in pg_replication_slots, then resume the pipeline. Artie continues from its last acknowledged position.What happens during a switchover
What happens during a switchover
PlanetScale switches over for parameter changes, resizes, and upgrades, and fails over if the primary goes down. With the settings above, the slot moves to the new primary and Artie resumes from its last acknowledged position after a brief gap.
Replicating another branch
Replicating another branch
Each branch is its own cluster and doesn’t inherit parameters, SQL-created roles, publications, or slots. Repeat these steps on that branch and create a separate Artie source with its credentials.
Private connectivity
Private connectivity
PlanetScale supports AWS PrivateLink. Otherwise, Artie connects from its fixed IP addresses.