mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:55:54 +08:00
PERF: n+1 query when fetching search_logs
This commit is contained in:
parent
648832a643
commit
2e7c61681e
|
@ -58,6 +58,7 @@ class SearchLog < ActiveRecord::Base
|
|||
END) AS click_through,
|
||||
MODE() WITHIN GROUP (ORDER BY clicked_topic_id) AS clicked_topic_id,
|
||||
COUNT(DISTINCT ip_address) AS unique")
|
||||
.includes(:topic)
|
||||
.where('created_at > ?', start_of(period))
|
||||
.group(:term)
|
||||
.order('COUNT(DISTINCT ip_address) DESC')
|
||||
|
|
Loading…
Reference in New Issue
Block a user