2023-07-20 14:44:23 +00:00
|
|
|
-- Drop the old indexes
|
2023-08-02 16:44:51 +00:00
|
|
|
DROP INDEX idx_post_aggregates_featured_local_hot;
|
2023-07-20 14:44:23 +00:00
|
|
|
|
2023-08-02 16:44:51 +00:00
|
|
|
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_comment_aggregates_hot;
|
|
|
|
|
|
|
|
DROP INDEX idx_comment_aggregates_score;
|
2023-07-20 14:44:23 +00:00
|
|
|
|
2023-08-02 16:44:51 +00:00
|
|
|
-- Add a published desc, to the end of the hot and active ranks
|
2023-07-20 14:44:23 +00:00
|
|
|
-- Add missing most comments index
|
2023-08-02 16:44:51 +00:00
|
|
|
CREATE INDEX idx_post_aggregates_featured_local_most_comments ON post_aggregates (featured_local DESC, comments DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_most_comments ON post_aggregates (featured_community DESC, comments DESC, published DESC);
|
2023-07-20 14:44:23 +00:00
|
|
|
|
|
|
|
-- featured_local
|
2023-08-02 16:44:51 +00:00
|
|
|
CREATE INDEX idx_post_aggregates_featured_local_hot ON post_aggregates (featured_local DESC, hot_rank DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_local_active ON post_aggregates (featured_local DESC, hot_rank_active DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_local_score ON post_aggregates (featured_local DESC, score DESC, published DESC);
|
2023-07-20 14:44:23 +00:00
|
|
|
|
|
|
|
-- featured_community
|
2023-08-02 16:44:51 +00:00
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_hot ON post_aggregates (featured_community DESC, hot_rank DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_active ON post_aggregates (featured_community DESC, hot_rank_active DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_score ON post_aggregates (featured_community DESC, score DESC, published DESC);
|
2023-07-20 14:44:23 +00:00
|
|
|
|
|
|
|
-- Fixing some comment aggregates ones
|
2023-08-02 16:44:51 +00:00
|
|
|
CREATE INDEX idx_comment_aggregates_hot ON comment_aggregates (hot_rank DESC, published DESC);
|
|
|
|
|
|
|
|
CREATE INDEX idx_comment_aggregates_score ON comment_aggregates (score DESC, published DESC);
|
2023-07-20 14:44:23 +00:00
|
|
|
|