update to rails 4.2.5.1, add debugging info for tracking slow queries

This commit is contained in:
r888888888
2016-02-23 16:33:43 -08:00
parent bb3eb9f980
commit 4b24a5cb7e
13 changed files with 670 additions and 646 deletions

View File

@@ -9,7 +9,7 @@ module PostSets
def posts
@posts ||= begin
query = ::Post.tag_match(@artist.name).limit(10)
query = ::Post.tag_match(@artist.name).where("true /* PostSets::Artist#posts */").limit(10)
query.each # hack to force rails to eager load
query
end

View File

@@ -70,7 +70,7 @@ module PostSets
end
def has_deleted?
tag_string !~ /status/ && ::Post.tag_match("#{tag_string} status:deleted").exists?
tag_string !~ /status/ && ::Post.tag_match("#{tag_string} status:deleted").where("true /* PostSets::Post#has_deleted */").exists?
end
def has_explicit?
@@ -127,9 +127,9 @@ module PostSets
if random
temp = get_random_posts()
elsif raw
temp = ::Post.raw_tag_match(tag_string).order("posts.id DESC").paginate(page, :count => post_count, :limit => per_page)
temp = ::Post.raw_tag_match(tag_string).order("posts.id DESC").where("true /* PostSets::Post#posts:1 */").paginate(page, :count => post_count, :limit => per_page)
else
temp = ::Post.tag_match(tag_string, read_only).paginate(page, :count => post_count, :limit => per_page)
temp = ::Post.tag_match(tag_string, read_only).where("true /* PostSets::Post#posts:2 */").paginate(page, :count => post_count, :limit => per_page)
end
temp.each # hack to force rails to eager load
temp