Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Strangely, getQueryLog doesn't even display the first query, only the get.

Last updated 2 years ago.
0

Any other thoughts on this?

Last updated 2 years ago.
0

Have you tried the laravel profiler?

If I am not wrong, it should be log all database queries.

Hope that helps.

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

anlutro said:

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

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

neon5 neon5 Joined 21 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.