1 -- Drop the new indexes
2 drop index idx_post_aggregates_featured_local_newest_comment_time,
3 idx_post_aggregates_featured_community_newest_comment_time,
4 idx_post_aggregates_featured_local_comments,
5 idx_post_aggregates_featured_community_comments,
6 idx_post_aggregates_featured_local_hot,
7 idx_post_aggregates_featured_community_hot,
8 idx_post_aggregates_featured_local_active,
9 idx_post_aggregates_featured_community_active,
10 idx_post_aggregates_featured_local_score,
11 idx_post_aggregates_featured_community_score,
12 idx_post_aggregates_featured_local_published,
13 idx_post_aggregates_featured_community_published;
15 -- Create the old indexes
16 create index idx_post_aggregates_newest_comment_time on post_aggregates (newest_comment_time desc);
17 create index idx_post_aggregates_comments on post_aggregates (comments desc);
18 create index idx_post_aggregates_hot on post_aggregates (hot_rank(score, published) desc, published desc);
19 create index idx_post_aggregates_active on post_aggregates (hot_rank(score, newest_comment_time) desc, newest_comment_time desc);
20 create index idx_post_aggregates_score on post_aggregates (score desc);
21 create index idx_post_aggregates_published on post_aggregates (published desc);