PERF: Active Record #pluck is twice faster

PERF: SqlBuilder bypasses AR converters and uses PG directly
This commit is contained in:
Sam
2015-05-13 16:45:59 +10:00
parent e81f122a3f
commit 51d82fc25d
4 changed files with 143 additions and 34 deletions

View File

@@ -137,7 +137,6 @@ class TopicQuery
pinned_ids = query.where('pinned_at IS NOT NULL AND category_id = ?', category.id)
.order('pinned_at DESC').pluck(:id)
non_pinned_ids = query.where('pinned_at IS NULL OR category_id <> ?', category.id).pluck(:id)
(pinned_ids + non_pinned_ids)[0...@options[:per_page]]
end