I have the following database table:
id - PK (Auto Increment)
hash - a unique index the value here is filled using the function "uniqid()"
title - string..
I want to query from table using a hash value not the id. Is this practice will load the server, as I know is the best way to get some row from the database table especially the one who contain high number of rows is searching using a primary key:
$row = Book::find(1);
Or I can use the following eloquent builder without worry of making unnecessary load to database server because he hash is set as a unique key:
$row = Book::where('hash',$hashFromAPiRequest)->first();
There is a package named laravel Scout, I am not sure if I really need to use it or not.