From 4fa04e88ac6142dfc7cd46a6d5d08f474688cb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Rodr=C3=ADguez?= Date: Sun, 27 Jan 2013 13:12:11 -0200 Subject: [PATCH 1/2] don't join the tags table here, it makes the query slower --- app/models/status_message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/status_message.rb b/app/models/status_message.rb index e4adc4f0a..e6c46cd4d 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -173,7 +173,7 @@ class StatusMessage < Post private def self.tag_stream(tag_ids) - joins(:tags).where(:tags => {:id => tag_ids}) + joins(:taggings).where('taggings.tag_id IN (?)', tag_ids) end end From 130e4cfbd231a2eb8d58423941435e359f045976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Rodr=C3=ADguez?= Date: Mon, 28 Jan 2013 19:00:32 -0200 Subject: [PATCH 2/2] update changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index cc9d7c397..28097498a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ * Update and refactor the default public view `public/default.html` [#3811](https://github.com/diaspora/diaspora/issues/3811) * Write unicorn stderr and stdout [#3785](https://github.com/diaspora/diaspora/pull/3785) * Ported aspects to backbone [#3850](https://github.com/diaspora/diaspora/pull/3850) +* Join tagging's table instead of tags to improve a bit the query [#3932](https://github.com/diaspora/diaspora/pull/3932) ## Features