Benjamin Crozat avatar

Benjamin Crozat

@benjamincrozat

N+1 database queries are the #1 killer in most Laravel projects.

Have you heard about Model::automaticallyEagerLoadRelationships()?

It can make a big difference.

On my blog's homepage:
→ Without: 38 queries (~24ms)
→ With: 13 queries (~8ms)
Obviously, in a production environment, with heavy tables and substantial traffic, the benefits compound and it's even more impressive.
Share
Explore

TweetCloner

Clone any tweet or thread, translate, remix, and republish in seconds. Find trending/viral tweets with our tweet aggregator to speed up content creation.

© 2024 TweetCloner All rights reserved.