mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 03:41:02 +00:00
544d30f0d4
* add token-based pagination + fast subscribed post view * add migrations * fix failing heuristic * revert * output pagination token as next_page, fix off-by-one, restructure * more cleanup * clean * format sql * fix comment * fix tests * e * empty * move last page thing * restructure a bit for readability * rename page_cursor * update for scaled sort * fix * sql format * fix * get rid of macros --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
59 lines
3.6 KiB
SQL
59 lines
3.6 KiB
SQL
-- these indices are used for single-community filtering and for the followed-communities (front-page) query
|
|
-- basically one index per Sort
|
|
-- index name is truncated to 63 chars so abbreviate a bit
|
|
CREATE INDEX idx_post_aggregates_community_active ON post_aggregates (community_id, featured_local DESC, hot_rank_active DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_controversy ON post_aggregates (community_id, featured_local DESC, controversy_rank DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_hot ON post_aggregates (community_id, featured_local DESC, hot_rank DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_scaled ON post_aggregates (community_id, featured_local DESC, scaled_rank DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_most_comments ON post_aggregates (community_id, featured_local DESC, comments DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_newest_comment_time ON post_aggregates (community_id, featured_local DESC, newest_comment_time DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_newest_comment_time_necro ON post_aggregates (community_id, featured_local DESC, newest_comment_time_necro DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_published ON post_aggregates (community_id, featured_local DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_community_score ON post_aggregates (community_id, featured_local DESC, score DESC, published DESC);
|
|
|
|
-- these indices are used for "per-community" filtering
|
|
-- these indices weren't really useful because whenever the query filters by featured_community it also filters by community_id, so prepend that to all these indexes
|
|
DROP INDEX idx_post_aggregates_featured_community_active;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_controversy;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_hot;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_scaled;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_most_comments;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time_necro;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_published;
|
|
|
|
DROP INDEX idx_post_aggregates_featured_community_score;
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_active ON post_aggregates (community_id, featured_community DESC, hot_rank_active DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_controversy ON post_aggregates (community_id, featured_community DESC, controversy_rank DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_hot ON post_aggregates (community_id, featured_community DESC, hot_rank DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_scaled ON post_aggregates (community_id, featured_community DESC, scaled_rank DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_most_comments ON post_aggregates (community_id, featured_community DESC, comments DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time ON post_aggregates (community_id, featured_community DESC, newest_comment_time DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time_necro ON post_aggregates (community_id, featured_community DESC, newest_comment_time_necro DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_published ON post_aggregates (community_id, featured_community DESC, published DESC);
|
|
|
|
CREATE INDEX idx_post_aggregates_featured_community_score ON post_aggregates (community_id, featured_community DESC, score DESC, published DESC);
|
|
|