Skip to content

Commit 8570839

Browse files
perf(solidus_admin): Sort by name in product controller
The name column has an index and it is the same default sorting as in solidus_backend. Remove distinct to reduce the response time even more. The view has no included left joins and it isn't necessary to filter duplicates. This reduce the response time for database with 700000 products from 1 second to 67ms.
1 parent c965562 commit 8570839

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

admin/app/controllers/solidus_admin/products_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ def index
1818
master: :prices,
1919
variants: :prices
2020
),
21-
param: :q
21+
param: :q,
22+
distinct: false
2223
)
2324

2425
set_page_and_extract_portion_from(
2526
products,
26-
ordered_by: {updated_at: :desc, id: :desc}
27+
ordered_by: {name: :asc}
2728
)
2829

2930
respond_to do |format|

0 commit comments

Comments
 (0)