Reputation: 109
Which eloquent statement will give a fast result?
$getData = User::selectRaw('user_name')->where('user_id',1)->first();
$getData = User::where('user_id',1)->first();
Upvotes: 0
Views: 811
Reputation: 17206
In this case, the difference on performance is negligible. To make the query faster, you need the field user_id
to be indexed in your database.
Upvotes: 2