Performance: Ordering and grouping
MEDIUM IMPACT
Ordering and grouping affect how quickly the database returns sorted or aggregated data, impacting page load speed and responsiveness.
DB::table('orders')->groupBy('status')->orderBy('created_at')->get();
DB::table('orders')->get()->sortBy('created_at')->groupBy('status');
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Ordering and grouping in PHP after fetch | N/A | N/A | Blocks rendering until data ready | [X] Bad |
| Ordering and grouping in database query | N/A | N/A | Faster data ready for rendering | [OK] Good |