Black Friday: the Laravel testing course is $149 instead of $249, through Dec 7. See the course →
logo

Are fast queries always good?

I mean, yeah! Right? Well, there's more to the story...

Joel Clermont
Joel Clermont
2023-08-29

From our daily Laravel tips email. Get the next one in your inbox.

When I think about optimizing a Laravel app, I primarily think about making it faster. And as we've discussed in a previous tip, usually if something is slow, it's the database. But last week, I saw an article with the provocative title "Fast database queries are not always better".

My initial reaction was "HUH??" but the author, Tim MacDonald, made some really good points. And as a bonus, he explained the relatively new DB::whenQueryingForLongerThan feature in Laravel, and how you can use it effectively. I highly encourage you to give a read.

Here to help,

Joel

P.S. Wish you could ship new features more quickly? We can help.

Want a tip like this in your inbox every weekday?

Each one takes less than 2 minutes to read. Join 4,000+ Laravel developers who already get them.

email
No spam. Only real-world advice.
Toss a coin in the jar if you found this helpful.