perf(db): drop redundant clinical_registry_record_sources_record_idx#491
Conversation
The standalone (record_id) index is a strict prefix of the index backing the UNIQUE (record_id, document_id) constraint, so it adds write overhead with no read benefit (same rationale as 20260702110000). Schema.sql is reconciled and drift-manifest.json regenerated from a scratch replay; tests/supabase-schema.test.ts 43/43 green. check:drift will transiently report the index as live-only until the migration is applied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…res-practices-3eeeb0
|
Updates to Preview Branch (claude/supabase-postgres-practices-3eeeb0) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
📝 WalkthroughWalkthroughThe PR removes a redundant ChangesRegistry source index cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (9 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
supabase/migrations/20260711000000_drop_redundant_registry_sources_record_index.sql (1)
1-19: 🧹 Nitpick | 🔵 TrivialSound cleanup; lock-mode tradeoff already documented.
The rationale for the redundant index removal is well-reasoned, and the plain
DROP INDEXvs.CONCURRENTLYtradeoff is already called out with a manual alternative for zero-impact removal. No further code change needed here.Since this migration touches
supabase/**, confirm the clinical governance preflight and production-readiness checks are completed before merge/apply.As per coding guidelines, "Pull requests touching ingestion, answer generation, search/ranking, source rendering, document access, privacy, production environment, or clinical output must complete the clinical governance preflight and relevant production-readiness checks."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260711000000_drop_redundant_registry_sources_record_index.sql` around lines 1 - 19, Confirm that the clinical governance preflight and applicable production-readiness checks have been completed for this Supabase migration before merging or applying it; no code changes are needed to the migration itself.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@supabase/migrations/20260711000000_drop_redundant_registry_sources_record_index.sql`:
- Around line 1-19: Confirm that the clinical governance preflight and
applicable production-readiness checks have been completed for this Supabase
migration before merging or applying it; no code changes are needed to the
migration itself.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c66c0b6-90ce-4274-a600-77ab23557686
📒 Files selected for processing (3)
supabase/drift-manifest.jsonsupabase/migrations/20260711000000_drop_redundant_registry_sources_record_index.sqlsupabase/schema.sql
Summary
Drops the redundant
clinical_registry_record_sources_record_idxon(record_id). It is a strict prefix of the index backing theUNIQUE (record_id, document_id)constraint on the same table, so Postgres already serves everyrecord_idequality lookup from the unique index — the standalone index only adds write overhead. Same rationale as20260702110000_drop_redundant_indexes.sql.Surfaced by the
supabase-postgres-best-practicesreview (query-covering / schema-foreign-key-index rules).Changes
supabase/migrations/20260711000000_drop_redundant_registry_sources_record_index.sql—drop index if exists(with the manualCONCURRENTLYalternative documented, since Supabase migrations run in a transaction).supabase/schema.sql— index removed; comment notes the unique index now servesrecord_idlookups.supabase/drift-manifest.json— regenerated from a scratch schema.sql replay.clinical_registry_record_sources_document_idxis kept —document_idis not a leading column of any other index and backs thedocumentsON DELETE CASCADE.Verification
tests/supabase-schema.test.ts— 43/43 passing against the merged tree.main(conflict-free; disjoint file changes) before this PR.Not in this PR
Clinical KB Databaseproject — that goes through the approved live migration workflow.check:driftwill report the index as live-only until then (expected pending-migration window).🤖 Generated with Claude Code