All examples

Engineering decision

One database, one schema per customer, or one database per customer?

Three models chose a shared schema with row-level security. Gemini chose a schema per tenant for regulated buyers.

The question

We are a 4-person team building a B2B SaaS product (customers are mid-size companies, 200 to 2,000 tenants expected in the first two years, a few of them regulated and likely to ask about data isolation). We use Postgres. Should we isolate tenants with a shared schema and a tenant_id column enforced by row-level security, a separate schema per tenant, or a separate database per tenant? We want to pick once and avoid a painful migration later.

The answer that came back

Use a shared schema with tenant_id on every table, enforced by row-level security via a non-superuser, non-table-owner app role, with tenant_id leading your composite indexes and automated cross-tenant isolation tests in CI. At 200-2,000 tenants with four engineers, schema-per-tenant means thousands of schemas, slow migrations, catalog bloat, and pooling pain, and database-per-tenant is operationally prohibitive. Keep the door open for the few regulated customers by making tenant routing configurable in your data-access layer, so a tenant can later be moved to a dedicated database or instance running the same codebase if a contract truly demands physical isolation. This answer rests on stable Postgres behavior rather than recent events, but it assumes no customer will require physical isolation at signing; if several do, revisit.

Agreement. Majority. Three of the four models chose the same option.

What each model said

Each answer is the model’s own words, with formatting marks removed.

  • Claude Sonnet 5.5

    Shared schema with tenant_id plus RLS. At 200–2,000 tenants and four engineers, schema-per-tenant means thousands of schemas, which makes migrations slow, bloats the catalog, and complicates pooling, while DB-per-tenant is operationally prohibitive. Make tenant_id a required column everywhere from day one, enforce RLS with a non-superuser app role, and put tenant_id in the leading position of composite indexes. For the few regulated customers, offer a dedicated database later via the same codebase. Key assumption: tenants are small-to-mid and no contract demands physical isolation upfront.

  • GPT-4.1

    Use a shared schema with tenant_id plus row-level security. This scales best for 200–2,000 tenants, minimizes operational complexity, and is well-supported in Postgres. It's production-proven and efficient for SaaS. Only use separate schemas or databases if tenants need full customizability or hard isolation for strict compliance, but that adds complexity and management overhead. If “regulated” just means strong logical isolation, this model suffices and is futureproof for most B2B SaaS.

  • Gemini 3.5 Flash-Lite

    Use separate schemas per tenant. Key reasoning: Mid-size B2B SaaS customers and regulated buyers frequently demand hard data boundaries. Shared schemas with Row-Level Security invite catastrophic human error and bypass compliance audits. Conversely, separate databases per tenant create massive connection-pooling bottlenecks and management overhead in Postgres at 2,000 tenants. Schemas provide the ideal balance: strict logical isolation and easy compliance tooling without connection explosion. Assumption: Your total tenant count stays under 2,000.

  • Grok 4.20

    Shared schema with tenant_id + RLS. Small team + 200-2k tenants makes per-schema or per-DB ops (migrations, monitoring, connection routing, backups) too expensive. One DB keeps everything simple, fast to iterate, and easy for analytics. Postgres RLS is mature and auditor-accepted when policies are tight and tested. Regulated customers are few; strong controls + transparency will satisfy them. Assumption: you won't face strict "separate DB only" mandates.

Where they differed

Claude, GPT-4.1 and Grok chose a shared schema with row-level security. Gemini chose a separate schema per tenant, arguing that regulated buyers often expect hard data boundaries and that row-level security leaves room for costly human error. The final answer names its own assumption: no customer requires physical isolation at signing.

About this run

Run on 26 October 2026 in quick mode with four models (Claude Sonnet 5.5, GPT-4.1, Gemini 3.5 Flash-Lite and Grok 4.20), one round, no cross-critique. Web search was off.

Pilot’s summary is advisory input, not a decision. Models can be wrong together, and agreement is not proof. This is an example, not advice for your situation.

More real debates: Browse all examples

Get a second opinion on your next decision.

Ask your own AI to get answers from several models, with the disagreement shown. You decide what to do with it.

Request early access