Skip to content

Add indexes in migrations that have already been running in production #1844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP INDEX IF EXISTS index_version_downloads_by_date;
DROP INDEX IF EXISTS index_recent_crate_downloads_by_downloads;
9 changes: 9 additions & 0 deletions migrations/2019-09-19-185655_add_experimental_indexes/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- These indexes were created on production by hand and never existed in migrations; give them
-- better names now that we know we want to keep them
ALTER INDEX IF EXISTS sgrif_testing RENAME TO index_recent_crate_downloads_by_downloads;
ALTER INDEX IF EXISTS sgrif_testing2 RENAME TO index_version_downloads_by_date;

-- Create the above indexes for databases other than production
CREATE INDEX IF NOT EXISTS index_recent_crate_downloads_by_downloads
ON recent_crate_downloads USING btree (downloads);
CREATE INDEX IF NOT EXISTS index_version_downloads_by_date ON version_downloads USING brin (date);