Skip to content

Commit c4db34c

Browse files
committed
Add indexes in migrations that have already been running in production
@sgrif added these to the production database by hand for testing purposes a while back; they seem to be performing well so they should get added to the codebase to keep the schema in sync.
1 parent 12c64bc commit c4db34c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DROP INDEX IF EXISTS index_version_downloads_by_date;
2+
DROP INDEX IF EXISTS index_recent_crate_downloads_by_downloads;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- These indexes were created on production by hand and never existed in migrations; give them
2+
-- better names now that we know we want to keep them
3+
ALTER INDEX IF EXISTS sgrif_testing RENAME TO index_recent_crate_downloads_by_downloads;
4+
ALTER INDEX IF EXISTS sgrif_testing2 RENAME TO index_version_downloads_by_date;
5+
6+
-- Create the above indexes for databases other than production
7+
CREATE INDEX IF NOT EXISTS index_recent_crate_downloads_by_downloads
8+
ON recent_crate_downloads USING btree (downloads);
9+
CREATE INDEX IF NOT EXISTS index_version_downloads_by_date ON version_downloads USING brin (date);

0 commit comments

Comments
 (0)