mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-25 04:11:31 +00:00
be1389420b
* SQL format checking, 1. * SQL format checking, 2. * SQL format checking, 3. * SQL format checking, 4. * SQL format checking, 5. * Running pg_format * Getting rid of comment. * Upping pg_format version. * Using git ls-files for sql format check. * Fixing sql lints. * Addressing PR comments.
42 lines
1.8 KiB
SQL
42 lines
1.8 KiB
SQL
-- Drop the old indexes
|
|
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_comment_aggregates_hot;
|
|
|
|
DROP INDEX idx_comment_aggregates_score;
|
|
|
|
-- Add a published desc, to the end of the hot and active ranks
|
|
-- Add missing most comments index
|
|
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);
|
|
|
|
-- featured_local
|
|
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);
|
|
|
|
-- featured_community
|
|
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);
|
|
|
|
-- Fixing some comment aggregates ones
|
|
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);
|
|
|