16 lines
742 B
SQL
16 lines
742 B
SQL
-- ============================================================
|
|
-- MISSING INDEXES — Run in Neon SQL Editor
|
|
-- ============================================================
|
|
-- These indexes exist in prisma/schema.prisma but are NOT on the
|
|
-- production database (lost during schema conflict resolution).
|
|
-- CONCURRENTLY ensures no table locks during creation.
|
|
-- ============================================================
|
|
|
|
-- SiteEvent: admin Signal Overview cross-brand queries
|
|
-- Without this, groupBy on 30M rows scans the entire table
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS "SiteEvent_eventType_timestamp_idx"
|
|
ON "SiteEvent" ("eventType", "timestamp");
|
|
|
|
-- Verify:
|
|
-- SELECT indexname FROM pg_indexes WHERE tablename = 'SiteEvent';
|