mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 06:05:40 +08:00
PERF: hit all index conditions to speed up anon ip tracking
This commit is contained in:
parent
2b2d0e803f
commit
4a48f983fd
@ -33,7 +33,7 @@ class TopicViewItem < ActiveRecord::Base
|
||||
builder = SqlBuilder.new(sql)
|
||||
|
||||
if !user_id
|
||||
builder.where("ip_address = :ip_address AND topic_id = :topic_id")
|
||||
builder.where("ip_address = :ip_address AND topic_id = :topic_id AND user_id IS NULL")
|
||||
else
|
||||
builder.where("user_id = :user_id AND topic_id = :topic_id")
|
||||
end
|
||||
|
@ -124,6 +124,7 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
def include_is_warning?
|
||||
is_warning
|
||||
end
|
||||
|
||||
def draft
|
||||
object.draft
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user