1 -- Rank = ScaleFactor * sign(Score) * log(1 + abs(Score)) / (Time + 2)^Gravity
2 create or replace function hot_rank(
4 published timestamp without time zone)
7 -- hours_diff:=EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600
8 return floor(10000*log(greatest(1,score+3)) / power(((EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600) + 2), 1.8))::integer;
15 idx_post_aggregates_hot,
16 idx_post_aggregates_active,
17 idx_post_aggregates_score,
18 idx_comment_published,
19 idx_comment_aggregates_hot,
20 idx_comment_aggregates_score,
22 idx_user_aggregates_comment_score,
23 idx_community_published,
24 idx_community_aggregates_hot,
25 idx_community_aggregates_subscribers;