Skip to content
Snippets Groups Projects

Draft: Refactor get_ranked_posts.sql to add a CTE to ensure posts get filtered by...

Closed Dan Notestein requested to merge speedup-ranked-posts into develop
3 unresolved threads
@@ -29,7 +29,6 @@ BEGIN
hp.id,
blacklist.source
FROM hivemind_app.live_posts_view hp
JOIN community_data cd ON hp.community_id = cd.id
LEFT OUTER JOIN hivemind_app.blacklisted_by_observer_view blacklist ON (_observer_id != 0 AND blacklist.observer_id = _observer_id AND blacklist.blacklisted_id = hp.author_id)
WHERE
hp.is_pinned AND hp.community_id = (SELECT id FROM hivemind_app.hive_communities WHERE name = _tag) --use hive_posts_community_id_is_pinned_idx
@@ -138,7 +137,7 @@ BEGIN
WITH -- get_trending_ranked_posts_for_communities
community_posts as MATERIALIZED
(
SELECT id FROM hivemind_app.live_posts_view
SELECT id, author_id, sc_trend FROM hivemind_app.live_posts_view
WHERE community_id = (SELECT id FROM hivemind_app.hive_communities WHERE name = _tag)
AND NOT hp.is_paidout --use index hive_posts_community_id_not_is_paidout_idx
),
Loading