Commit 2dc22af
committed
perf(solidus_admin): Remove created_at order
The created_at column does not have an index and there will be a tmp table created to order the result set. This will cause a delay on huge data sets.
Move the order statement into the search scopes to sort each scope individually. It is also faster to sort only one column instead of two. Only the scopes that are filtering already completed orders will sort by completed_at.
This change reduced the loading time of 8M orders from 18sec to 836ms.1 parent 192ff25 commit 2dc22af
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments