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();
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();
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.