From d0c94a4f49b1ae4ad718472e80d5d097a6eeb8fc Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 2 Feb 2023 14:09:32 -0500 Subject: [PATCH] Fixing GetPosts active sort index. Fixes #2683 (#2684) * Fixing GetPosts active sort index. Fixes #2683 * Fixing other sort. --- migrations/2023-02-01-012747_fix_active_index/down.sql | 6 ++++++ migrations/2023-02-01-012747_fix_active_index/up.sql | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 migrations/2023-02-01-012747_fix_active_index/down.sql create mode 100644 migrations/2023-02-01-012747_fix_active_index/up.sql diff --git a/migrations/2023-02-01-012747_fix_active_index/down.sql b/migrations/2023-02-01-012747_fix_active_index/down.sql new file mode 100644 index 00000000..356e3b8c --- /dev/null +++ b/migrations/2023-02-01-012747_fix_active_index/down.sql @@ -0,0 +1,6 @@ +drop index + idx_post_aggregates_featured_local_active, + idx_post_aggregates_featured_community_active; + +create index idx_post_aggregates_featured_local_active on post_aggregates (featured_local desc, hot_rank(score, newest_comment_time) desc, newest_comment_time desc); +create index idx_post_aggregates_featured_community_active on post_aggregates (featured_community desc, hot_rank(score, newest_comment_time) desc, newest_comment_time desc); diff --git a/migrations/2023-02-01-012747_fix_active_index/up.sql b/migrations/2023-02-01-012747_fix_active_index/up.sql new file mode 100644 index 00000000..5673cf45 --- /dev/null +++ b/migrations/2023-02-01-012747_fix_active_index/up.sql @@ -0,0 +1,7 @@ +-- This should use the newest_comment_time_necro, not the newest_comment_time for the hot_rank +drop index + idx_post_aggregates_featured_local_active, + idx_post_aggregates_featured_community_active; + +create index idx_post_aggregates_featured_local_active on post_aggregates (featured_local desc, hot_rank(score, newest_comment_time_necro) desc, newest_comment_time_necro desc); +create index idx_post_aggregates_featured_community_active on post_aggregates (featured_community desc, hot_rank(score, newest_comment_time_necro) desc, newest_comment_time_necro desc); -- 2.44.1