Back to Blog

Point AI at a Read Replica (Not Your Primary)

When you need current production-shaped data for Claude or Cursor, use a read replica — not the primary. Why replicas beat 'careful on prod,' how to wire Synra, and when staging is still enough.

Staging first is still the default. Eventually someone needs numbers that match production today — support, finance, a launch check.

Upgrade path is not “paste the primary DATABASE_URL into Synra and be careful.” It’s a read replica (or a prod-shaped branch you treat like one).

Gateway read-only blocks AI writes. A replica keeps load off the writer and makes the job obvious: this URL is not for migrations.

Ladder: staging first → replica when freshness matters → primary almost never for chat.

Staging vs replica vs primary

| Target | Data freshness | Risk / load | Good for | |--------|----------------|-------------|----------| | Staging / sanitized branch | Often stale or fake PII | Lowest | Learning, prompts, weekly drafts | | Read replica | Near-prod | Reads can see real PII; load off primary | Current counts, cancel triage, launch checks | | Primary | Live | Writer load + habit risk | App traffic — not AI curiosity |

If you only have staging, stay there until a replica exists. Don’t invent urgency.

Why replicas fit AI workloads

AI chat is chatty. People retry. Monday jobs repeat. Agents explore schema.

That pattern on a primary is how you get slow checkouts and angry DBAs. On a replica, the worst case is a slow analytical session on a node built for reads.

Also psychological: naming the Synra connection prod-replica beats prod with a sticky note that says read-only.

How to wire it (generic Postgres)

  1. Create or enable a read replica in your host (RDS replica, Cloud SQL replica, Neon read replica, etc.).
  2. Copy the replica connection string — not the primary.
  3. Prefer a SELECT-only user that only exists for AI (or is limited to the replica).
  4. In Synra: new connection, paste replica URI, name it prod-replica or neon-replica.
  5. Restrict tables.
  6. Verify counts you know; confirm a write fails.
  7. Share only with people who need current data — team sharing.

Host notes:

  • Neon — use a read replica or a branch you treat as read-only; don’t default Claude to main compute you use for writes.
  • Railway — public TCP proxy URL for Synra; private railway.internal won’t work from outside (Railway guide). Replicas depend on how you run Postgres there.
  • Supabase — often a separate read path or a staging project; service role still sees PII — see Claude + Supabase.

Replication lag

Replicas can lag seconds (or more under load). If the AI says “12 signups in the last five minutes” and the primary already has 15, lag is a suspect.

For board-level “as of now,” say so in the prompt: “tolerate replica lag; we’re fine with ~minute-old data.” For payment-debug “did this row just write?”, use the admin tool on the primary — not chat.

What a replica does not fix

Decision rule

  • Learning the product / prompts → staging
  • Need prod-shaped current numbers → replica
  • “Just this once” on primary → almost always no; make a replica or refuse

Fresh enough for decisions, off the writer — that’s the replica URL.

7-day trial at mcpserver.design. Name the connection prod-replica when you have the string.

Related reading: