Merge pull request #4500 from tgxworld/performance_on_users_page
PERF: Remove ordering by username.
This commit is contained in:
commit
bfa33f2518
|
@ -44,8 +44,7 @@ class DirectoryItemsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
result = result.order('users.username')
|
result_count = result.count
|
||||||
result_count = result.dup.count
|
|
||||||
result = result.limit(PAGE_SIZE).offset(PAGE_SIZE * page).to_a
|
result = result.limit(PAGE_SIZE).offset(PAGE_SIZE * page).to_a
|
||||||
|
|
||||||
more_params = params.slice(:period, :order, :asc)
|
more_params = params.slice(:period, :order, :asc)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class AddDirectoryItemsIndexes < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_index :directory_items, :likes_received
|
||||||
|
add_index :directory_items, :likes_given
|
||||||
|
add_index :directory_items, :topics_entered
|
||||||
|
add_index :directory_items, :topic_count
|
||||||
|
add_index :directory_items, :post_count
|
||||||
|
add_index :directory_items, :posts_read
|
||||||
|
add_index :directory_items, :days_visited
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue