You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
idx_snapshots_sandbox_id is an exact duplicate of snapshots_sandbox_id_unique (same single column, same order). The unique index serves all lookups; the copy has 0 lifetime scans in pg_stat_user_indexes, while every snapshot write maintains it for nothing.
DROP INDEX CONCURRENTLY with the same timeout/INVALID-leftover handling as the recent drop-index precedent. Down rebuilds it concurrently (unbounded timeout, manual operation by design).
Low Risk
Read-path coverage stays on the existing unique constraint; the change is a concurrent index drop with established timeout and rollback handling on a large table.
Overview
Removes the redundant non-unique idx_snapshots_sandbox_id index on snapshots.sandbox_id because it mirrors snapshots_sandbox_id_unique and only adds write overhead. The migration drops it with DROP INDEX CONCURRENTLY, uses a bounded statement_timeout for the Up path and restores the migrator’s 3h session default afterward; Down can rebuild the index concurrently with unbounded timeout and clears any INVALID leftover first.
Reviewed by Cursor Bugbot for commit 1670e07. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
idx_snapshots_sandbox_idis an exact duplicate ofsnapshots_sandbox_id_unique(same single column, same order). The unique index serves all lookups; the copy has 0 lifetime scans inpg_stat_user_indexes, while every snapshot write maintains it for nothing.DROP INDEX CONCURRENTLYwith the same timeout/INVALID-leftover handling as the recent drop-index precedent. Down rebuilds it concurrently (unbounded timeout, manual operation by design).