Phase 7: Decision Gate and Rollout
Goal
Decide whether Prisma Postgres should become TendSocial's primary production database based on measured operation counts, query performance, and event-log offload results.
Decision inputs
| Input | Source |
|---|---|
| Prisma setup report | Phase 1 |
| API operation report | Phase 2 |
| Standard Playwright operation report | Phase 2 |
| Exhaustive Playwright operation report | Phase 2 |
| DB tuning before/after report | Phase 3 |
| Index before/after report | Phase 4 |
| Cache before/after report | Phase 5 |
| Analytics/event offload report | Phase 6 |
| Estimated monthly Prisma operations | Phase 2 aggregate |
| Estimated monthly storage | Seed + forecast |
| Prisma pricing tier fit | Pricing model |
Cost model
Use the operation-count report to calculate expected monthly usage.
Inputs
text
monthly_active_users
avg_sessions_per_user_per_month
avg_actions_per_session
avg_orm_ops_per_action
background_ops_per_month
storage_gbFormula
text
interactive_ops =
monthly_active_users
* avg_sessions_per_user_per_month
* avg_actions_per_session
* avg_orm_ops_per_action
total_ops =
interactive_ops + background_ops_per_monthPrisma price reference
| Plan | Base | Included operations | Included storage | Overage |
|---|---|---|---|---|
| Free | $0 | 100k | 500 MB | n/a |
| Starter | $10/mo | 1M | 10 GB | $0.008 / 1k ops; $2/GB |
| Pro | $49/mo | 10M | 50 GB | $0.002 / 1k ops; $1.50/GB |
| Business | $129/mo | 50M | 100 GB | $0.001 / 1k ops; $1/GB |
Source: Prisma pricing.
Go/no-go criteria
Go
Proceed with Prisma Postgres if:
| Gate | Target |
|---|---|
| Dev/staging stable | Yes |
| Runtime uses pooled URL | Yes |
| Migrations use direct URL | Yes |
| Top 20 expensive actions fixed or ticketed | 100% |
| High-volume analytics/event logs removed from Prisma | Yes |
| Normal dashboard load | <10-20 Prisma ops |
| Calendar/content load | <20-30 Prisma ops |
| Draft/post save | <5-15 Prisma ops |
| Background jobs | Bounded and paginated |
| 50-user forecast | Pro or lower preferred |
| 500-user forecast | Business or lower preferred |
| Rollback plan tested | Yes |
No-go / delay
Delay cutover if:
| Problem | Action |
|---|---|
| Operation counts are dominated by N+1 patterns | Complete Phase 3 first |
| Calendar/content routes are unbounded | Complete pagination/index work |
| Analytics/events still write to Prisma | Complete Phase 6 |
| Connection exhaustion appears | Check pooled/direct URL split and PrismaClient singleton |
| Cost forecast exceeds Business early | Rework query shape/caching before cutover |
| Rollback path is untested | Do not cut over |
Rollout plan
Step 1: Staging cutover
- Point staging backend to Prisma Postgres.
- Keep Neon untouched.
- Run smoke tests.
- Run API operation suite.
- Run standard Playwright suite.
- Run exhaustive suite.
- Review Query Insights.
Step 2: Limited production shadow
If possible, duplicate non-mutating reads or replay production-like traffic against Prisma benchmark/staging. Do not double-write user-facing production state unless explicitly implemented and tested.
Step 3: Production cutover window
- Freeze deploys.
- Verify Supabase Auth unaffected.
- Verify R2 unaffected.
- Point backend production env to Prisma Postgres pooled URL.
- Verify CLI/migration env has direct URL.
- Deploy.
- Run production smoke test.
- Watch errors, query volume, operations, and latency.
Step 4: Fallback
Maintain Neon fallback for an agreed period:
text
minimum: 7 days
preferred: 14-30 daysRollback means restoring the backend database env vars to Neon and redeploying.
Production monitoring after cutover
Watch:
text
Prisma operations per hour/day
Prisma plan quota burn rate
Slow query count
P95/P99 API latency
Connection pool utilization
Background job operation rate
Top repeated queries
Storage growth
Error ratesFinal artifacts
The spike is complete when these are available:
text
reports/dbops/api-summary.md
reports/dbops/e2e-standard.md
reports/dbops/e2e-exhaustive.md
reports/dbops/e2e-exhaustive-hotspots.md
reports/dbops/tuning-before-after.md
reports/dbops/index-before-after.md
reports/dbops/cache-before-after.md
reports/dbops/analytics-offload-audit.md
reports/dbops/prisma-cost-forecast.mdFinal decision statement template
md
# Prisma Postgres Decision
Decision: Proceed / Delay / Reject
Reason:
- Measured monthly operation forecast:
- Expected Prisma plan:
- Expected DB monthly cost:
- Top remediated hot spots:
- Remaining risks:
- Rollback path:
- Date: