I have this data I'm trying to pull, but I have a lot of rows in the DB so it can take 12 secs to return results. Any ideas on how to improve performance?
$completedActivities = Activity::where('executed_at', '>', Carbon::now()->subDays(14))
->where('pending', false)
->where('user_id', auth()->user()->id)
->orderby('executed_at', 'desc')
->limit(100)->get();
I tried pulling only items from last 14 days (to reduce pulling all activities from db) and tried limiting to 100. any other ideas? refactor maybe?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire