mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: we have no use for topic percent rank
Prepare to remove this column
This commit is contained in:
@@ -20,7 +20,6 @@ class ScoreCalculator
|
||||
update_posts_score(opts)
|
||||
update_posts_rank(opts)
|
||||
update_topics_rank(opts)
|
||||
update_topics_percent_rank(opts)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -120,23 +119,6 @@ SQL
|
||||
builder.exec
|
||||
end
|
||||
|
||||
def update_topics_percent_rank(opts)
|
||||
|
||||
builder = DB.build <<~SQL
|
||||
UPDATE topics SET percent_rank = x.percent_rank
|
||||
FROM (SELECT id, percent_rank()
|
||||
OVER (ORDER BY SCORE DESC) as percent_rank
|
||||
FROM topics) AS x
|
||||
/*where*/
|
||||
SQL
|
||||
|
||||
builder.where("x.id = topics.id AND (topics.percent_rank <> x.percent_rank OR topics.percent_rank IS NULL)")
|
||||
|
||||
filter_topics(builder, opts)
|
||||
|
||||
builder.exec
|
||||
end
|
||||
|
||||
def filter_topics(builder, opts)
|
||||
return builder unless opts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user