Premium video course

Eloquent Performance Patterns

Learn how to drastically improve the performance of your Laravel applications by pushing more work to the database, all while still using the Eloquent ORM.

Get notified when the course is ready!
You'll be joining my mailing list, where I share news about Laravel, database performance, Inertia.js, and other interesting programming topics.

Performance issues suck. Customers are frustrated. Your servers are overloaded. Management is breathing down your neck.

You've already solved all your N+1 issues, added the necessary indexes, and you're even paying for the most expensive database server available. But despite all this, some things just feel impossible to build in a performant way.

  1. We can't paginate results in the database because they depend on authorization checks that happen in Laravel.
  2. We have to do some really complicated calculations on large data sets, which seems impossible without a real programming language like PHP.
  3. We can't sort results in the database, because we have to sort by values computed in our application.

So you invest months into different caching strategies to try and speed things up, but caching is hard. Every time you think you've solved a performance problem, you have a new caching problem to deal with instead.

I've been there and it sucks. So one day I decided “that's it, I'm going to figure out how to push all this work to the database if it kills me.” The results blew my mind.

By leveraging advanced database techniques, like sub queries, conditional aggregates, and aggressive use of scopes, pages that took 30+ seconds to load were now loading within 500ms!!

I've since spoken about Eloquent and database performance at both Laracon Online and Laracon US, and have written in-depth articles on the topic.

Eloquent Performance Patterns is a culmination of everything I've learned along my journey, distilled into a single course. We're going to dig deep into advanced real world problems. This isn't another Eloquent introduction course.

What you’ll learn:

  • The three key metrics to better database performance
  • The incredible power of sub queries
  • When to use joins vs sub queries
  • Using sub queries to select related data
  • Using sub queries to build dynamic relationships
  • Using sub queries to order by related data
  • Calculating totals using conditional aggregates
  • Running authorization policies in the database
  • Building complex search filters
  • Extending the query builder using macros
  • Demystifying database indexes
  • Introducing complex queries without sacrificing Eloquent's API
  • Leveraging vendor-specific (MySQL, Postgres, etc.) features
  • Caching and database denormalization
  • How to safely write raw database queries
  • Configuring Laravel to make N+1 issues impossible
  • Extending Eloquent to support ordering with NULLS LAST and NULLS FIRST
  • Short circuiting queries using WHERE NOT EXISTS clauses
  • Sorting by nearness using longitude and latitude coordinates
  • Querying records within a physical area using geospatial shapes
This is the course the Laravel community needed. Performance is always a hot topic, but most advice is surface level, micro-optimizations at best. Jonathan's approach to performance is next level, and you NEED to learn these techniques.
Adam Wathan
Author of Test-Driven Laravel
Jonathan Reinink is one of the top thinkers in the Laravel community about how to use and optimize databases. He’s a great guy, a clear and capable teacher, and really knows his stuff. I can’t think of anyone else I’d want to learn from more about database performance in Laravel.
Matt Stauffer
Author of Laravel: Up & Running
Jonathan’s the real deal. In a sea of contrived examples, this dude delivers solid content born out of the real world. On top of that, he’s a clear thinker with a taste for simplicity, so his stuff’s in-line with the “Laravel spirit” and is easy to grok.
Caleb Porzio
Creator of Livewire
Reinink's approach to development is always grounded in simple and practical theory with a focus on developer experience. I've learned so much from following his work and this course is an absolute must-purchase for my own.
David Hemphill
Creator of Laravel Nova
Jonathan Reinink

About the author

Hey there! My name is Jonathan Reinink. I've been doing web development for roughly 20 years now, and have been working with Laravel since 2013. I am active in the open-source community, and have contributed numerous libraries, including Glide, Advanced Eloquent, Tailwind CSS, and more recently, Inertia.js. Outside of open-source, I own and operate a SaaS business called Church Social. You can learn more about me on my personal website.
Get notified when the course is ready!
You'll be joining my mailing list, where I share news about Laravel, database performance, Inertia.js, and other interesting programming topics.