Most likely in two queries, you can always check what queries was used with DB::getQueryLog() . But I am pretty sure there will be two queries. If you want you can create transaction.
Strangely, getQueryLog doesn't even display the first query, only the get.
Have you tried the laravel profiler?
If I am not wrong, it should be log all database queries.
Hope that helps.
raw()
does not execute a query, it just constructs an Expression
object of the SQL, which is not sanitized.
You'll probably want to use DB::statement()
.
anlutro said:
raw()
does not execute a query, it just constructs anExpression
object of the SQL, which is not sanitized.You'll probably want to use
DB::statement()
.
Thanks anlutro!
I can see see this one in the log now so I know it's running. However, it is hard to tell if I am gaining anything from it as I only have about 6 test records.
When I measure the DB call without the READ UNCOMMITTED it takes on average 2.5ms.
Adding the statements bumps the average up to 3ms.
But I'm guessing that the overhead of the statement is greater than any gain realized by querying only 6 records.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community