← back to Homesonspec
db(homesonspec): drop unused ValidationEvent(ruleId,passed) index — 0 scans, ~508MB reclaim (TK-10878)
bd19db5f2a6d07cf9df8f16732c80ac5265f21d9 · 2026-08-26 09:59:59 -0700 · Steve
Files touched
A packages/database/prisma/migrations/20260826165959_drop_unused_validationevent_ruleid_passed_idx/migration.sqlM packages/database/prisma/schema.prisma
Diff
commit bd19db5f2a6d07cf9df8f16732c80ac5265f21d9
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Aug 26 09:59:59 2026 -0700
db(homesonspec): drop unused ValidationEvent(ruleId,passed) index — 0 scans, ~508MB reclaim (TK-10878)
---
.../migration.sql | 7 +++++++
packages/database/prisma/schema.prisma | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/packages/database/prisma/migrations/20260826165959_drop_unused_validationevent_ruleid_passed_idx/migration.sql b/packages/database/prisma/migrations/20260826165959_drop_unused_validationevent_ruleid_passed_idx/migration.sql
new file mode 100644
index 00000000..74a5bb8d
--- /dev/null
+++ b/packages/database/prisma/migrations/20260826165959_drop_unused_validationevent_ruleid_passed_idx/migration.sql
@@ -0,0 +1,7 @@
+-- Drop unused index "ValidationEvent_ruleId_passed_idx".
+-- Evidence (TK-10878, pg_stat_user_indexes on homesonspec prod 2026-08-26):
+-- idx_scan = 0 over the table's lifetime; size ~508 MB on 51M rows.
+-- Nothing FK-references ValidationEvent; the hot @@index([stagedRecordId]) (679k scans) is retained.
+-- DROP INDEX (non-concurrent) is a fast catalog op with only a brief lock; it does not scan the table.
+-- Reversible: re-add @@index([ruleId, passed]) to the ValidationEvent model and migrate.
+DROP INDEX "ValidationEvent_ruleId_passed_idx";
diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma
index d9255fc1..46b200de 100644
--- a/packages/database/prisma/schema.prisma
+++ b/packages/database/prisma/schema.prisma
@@ -507,7 +507,8 @@ model ValidationEvent {
stagedRecord StagedRecord @relation(fields: [stagedRecordId], references: [id])
@@index([stagedRecordId])
- @@index([ruleId, passed])
+ // Dropped @@index([ruleId, passed]) — 0 index scans over table lifetime, ~508MB reclaimed (TK-10878).
+ // Re-add if a ruleId/passed query path appears.
}
model ChangeEvent {
← 5f8d356c ops: DB reclaim runbook (TK-10878) — O1 dedup + O3 partition
·
back to Homesonspec
·
db(homesonspec): guard TK-10878 index-drop with lock_timeout 63fa1185 →