mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 11:03:24 +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…
x
Reference in New Issue
Block a user