X-Git-Url: http://these/git/?a=blobdiff_plain;ds=sidebyside;f=migrations%2F2023-07-14-154840_add_optimized_indexes_published%2Fdown.sql;h=7bc306f9137f2db2236d24c33e1d8957665ce450;hb=be1389420b9dc4516f1e9b3e82637f84919a438e;hp=5661a3146d641812475694c1964559a17d22a464;hpb=b4380cb548f507ab53fa0808ab21d8270646cb36;p=lemmy.git diff --git a/migrations/2023-07-14-154840_add_optimized_indexes_published/down.sql b/migrations/2023-07-14-154840_add_optimized_indexes_published/down.sql index 5661a314..7bc306f9 100644 --- a/migrations/2023-07-14-154840_add_optimized_indexes_published/down.sql +++ b/migrations/2023-07-14-154840_add_optimized_indexes_published/down.sql @@ -1,26 +1,40 @@ -- Drop the new indexes -drop index idx_post_aggregates_featured_local_most_comments; -drop index idx_post_aggregates_featured_local_hot; -drop index idx_post_aggregates_featured_local_active; -drop index idx_post_aggregates_featured_local_score; -drop index idx_post_aggregates_featured_community_hot; -drop index idx_post_aggregates_featured_community_active; -drop index idx_post_aggregates_featured_community_score; -drop index idx_post_aggregates_featured_community_most_comments; -drop index idx_comment_aggregates_hot; -drop index idx_comment_aggregates_score; +DROP INDEX idx_post_aggregates_featured_local_most_comments; + +DROP INDEX idx_post_aggregates_featured_local_hot; + +DROP INDEX idx_post_aggregates_featured_local_active; + +DROP INDEX idx_post_aggregates_featured_local_score; + +DROP INDEX idx_post_aggregates_featured_community_hot; + +DROP INDEX idx_post_aggregates_featured_community_active; + +DROP INDEX idx_post_aggregates_featured_community_score; + +DROP INDEX idx_post_aggregates_featured_community_most_comments; + +DROP INDEX idx_comment_aggregates_hot; + +DROP INDEX idx_comment_aggregates_score; -- Add the old ones back in -- featured_local -create index idx_post_aggregates_featured_local_hot on post_aggregates (featured_local desc, hot_rank desc); -create index idx_post_aggregates_featured_local_active on post_aggregates (featured_local desc, hot_rank_active desc); -create index idx_post_aggregates_featured_local_score on post_aggregates (featured_local desc, score desc); +CREATE INDEX idx_post_aggregates_featured_local_hot ON post_aggregates (featured_local DESC, hot_rank DESC); + +CREATE INDEX idx_post_aggregates_featured_local_active ON post_aggregates (featured_local DESC, hot_rank_active DESC); + +CREATE INDEX idx_post_aggregates_featured_local_score ON post_aggregates (featured_local DESC, score DESC); -- featured_community -create index idx_post_aggregates_featured_community_hot on post_aggregates (featured_community desc, hot_rank desc); -create index idx_post_aggregates_featured_community_active on post_aggregates (featured_community desc, hot_rank_active desc); -create index idx_post_aggregates_featured_community_score on post_aggregates (featured_community desc, score desc); +CREATE INDEX idx_post_aggregates_featured_community_hot ON post_aggregates (featured_community DESC, hot_rank DESC); + +CREATE INDEX idx_post_aggregates_featured_community_active ON post_aggregates (featured_community DESC, hot_rank_active DESC); + +CREATE INDEX idx_post_aggregates_featured_community_score ON post_aggregates (featured_community DESC, score DESC); + +CREATE INDEX idx_comment_aggregates_hot ON comment_aggregates (hot_rank DESC); -create index idx_comment_aggregates_hot on comment_aggregates (hot_rank desc); -create index idx_comment_aggregates_score on comment_aggregates (score desc); +CREATE INDEX idx_comment_aggregates_score ON comment_aggregates (score DESC);