Skip to content

Commit adf28ad

Browse files
committed
Auto merge of #1844 - integer32llc:add-prod-indexes-to-migrations, r=carols10cents
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. r? @sgrif, feel free to wait to merge this until you've checked the bloat you mentioned wanting to check; I'm happy to update this PR if needed. Just wanted to have something around as a reminder.
2 parents b8185a0 + c4db34c commit adf28ad

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)