Skip to main content
CourseFlix

Eloquent Performance Patterns

2h 12m 50s
English
Paid

Learn how to improve the speed of your Laravel apps by moving more work to the database while still using Eloquent. This course shows you clear steps you can use right away.

The Problem

Slow apps cause stress. Users wait. Servers work too hard. You feel pressure from every side.

You fix N+1 queries. You add indexes. You pay for stronger servers. But some tasks still feel slow and hard to build.

Common Roadblocks

  • You cannot paginate in the database because your checks run in Laravel.
  • You need heavy calculations on large data sets, and you think only PHP can handle them.
  • You sort by values created in your app, not in the database.

You try caching. It helps for a moment. Then you fight new cache bugs and stale data. The loop never ends.

A Different Path

I felt the same pain. So I set out to push as much work as possible to the database. I tested ideas. I broke things. I learned many patterns that changed how I build apps.

With tools like subqueries, conditional aggregates, and smart scopes, pages that once took over 30 seconds now load in under a second.

Why This Matters

I have shared these ideas at events like Laracon Online and Laracon US. I have also written articles on advanced Eloquent patterns.

About the Author: Jonathan Reinink

Jonathan Reinink thumbnail

Jonathan Reinink is a Canadian software engineer and the creator of Inertia.js — the modern monolith framework that lets Laravel and Rails developers build SPAs without the typical SPA complexity, by treating server-rendered pages and client-side React / Vue components as a unified stack.

His CourseFlix listing carries Eloquent Performance Patterns — a deep treatment of Laravel Eloquent ORM performance: the query patterns, the N+1 traps, eager loading strategies, and the engineering decisions that separate fast Eloquent code from the default slow patterns.

Material is paid and aimed at Laravel developers running Eloquent at scale. For broader content, see CourseFlix's Laravel category page.

Watch Online 28 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 28 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Measuring your database performance
All Course Lessons (28)
#Lesson TitleDurationAccess
1
Measuring your database performance Demo
04:43
2
Minimizing memory usage by selecting only
04:29
3
Getting one record from has-many relationships
09:44
4
Creating dynamic relationships using sub queries
06:10
5
Calculating totals using conditional aggregates
04:21
6
Optimizing circular relationships
04:25
7
Setting up multi-column searching
04:07
8
Getting LIKE to use an index
05:05
9
Faster options than whereHas
03:55
10
When it makes sense to run additional queries
03:08
11
Using UNIONs to run queries independently
07:58
12
Fuzzier searching using regular expressions
04:45
13
Running authorization policies in the database
06:04
14
Faster ordering using compound indexes
04:05
15
Ordering by has-one relationships
01:38
16
Ordering by belongs-to relationships
01:39
17
Ordering by has-many relationships
04:21
18
Ordering by belongs-to-many relationships
05:39
19
Ordering with NULLs always last
07:36
20
Ordering by custom algorithms
06:38
21
Filtering and sorting anniversary dates
07:04
22
Making N+1 issues impossible
03:24
23
Ordering data for humans using natural sort
04:20
24
Full text searching with rankings
05:07
25
Getting the distance between geographic points
03:23
26
Filtering by geographic distance
03:00
27
Ordering by geographic distance
01:26
28
Filtering by geospatial area
04:36
Unlock unlimited learning

Get instant access to all 27 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Course content

28 lessons · 2h 12m 50s
Show all 28 lessons
  1. 1 Measuring your database performance 04:43
  2. 2 Minimizing memory usage by selecting only 04:29
  3. 3 Getting one record from has-many relationships 09:44
  4. 4 Creating dynamic relationships using sub queries 06:10
  5. 5 Calculating totals using conditional aggregates 04:21
  6. 6 Optimizing circular relationships 04:25
  7. 7 Setting up multi-column searching 04:07
  8. 8 Getting LIKE to use an index 05:05
  9. 9 Faster options than whereHas 03:55
  10. 10 When it makes sense to run additional queries 03:08
  11. 11 Using UNIONs to run queries independently 07:58
  12. 12 Fuzzier searching using regular expressions 04:45
  13. 13 Running authorization policies in the database 06:04
  14. 14 Faster ordering using compound indexes 04:05
  15. 15 Ordering by has-one relationships 01:38
  16. 16 Ordering by belongs-to relationships 01:39
  17. 17 Ordering by has-many relationships 04:21
  18. 18 Ordering by belongs-to-many relationships 05:39
  19. 19 Ordering with NULLs always last 07:36
  20. 20 Ordering by custom algorithms 06:38
  21. 21 Filtering and sorting anniversary dates 07:04
  22. 22 Making N+1 issues impossible 03:24
  23. 23 Ordering data for humans using natural sort 04:20
  24. 24 Full text searching with rankings 05:07
  25. 25 Getting the distance between geographic points 03:23
  26. 26 Filtering by geographic distance 03:00
  27. 27 Ordering by geographic distance 01:26
  28. 28 Filtering by geospatial area 04:36

Related courses

  • Facebook Clone with Laravel, TDD, Vue & Tailwind CSS thumbnail

    Facebook Clone with Laravel, TDD, Vue & Tailwind CSS

    By: Udemy
    Building modern applications requires a specialized toolbox of skills and tools. We are going to be using Facebook as an example to build a social network platf
    9 hours 9 minutes 44 seconds
  • Laravel 8 - Advance Course Build School Management System thumbnail

    Laravel 8 - Advance Course Build School Management System

    By: Udemy
    Laravel is an open-source PHP framework, which is robust and easy to understand. It follows a model-view-controller design pattern. Laravel reuses the existing
    80 hours 43 minutes 53 seconds 5 / 5
  • Let's Build a Go version of Laravel thumbnail

    Let's Build a Go version of Laravel

    By: Udemy
    Laravel is one of the most popular web web application frameworks in the PHP world, and with good reason. It's easy to use, well designed, and lets developers w
    19 hours 22 minutes 16 seconds

Frequently asked questions

What is Eloquent Performance Patterns about?
Learn how to improve the speed of your Laravel apps by moving more work to the database while still using Eloquent. This course shows you clear steps you can use right away. The Problem Slow apps cause stress. Users wait. Servers work too…
Who teaches Eloquent Performance Patterns?
Eloquent Performance Patterns is taught by Jonathan Reinink. You can find more courses by this instructor on the corresponding source page.
How long is Eloquent Performance Patterns?
Eloquent Performance Patterns contains 28 lessons with a total runtime of 2 hours 12 minutes. All lessons are available to watch online at your own pace.
Is Eloquent Performance Patterns free to watch?
Eloquent Performance Patterns is part of CourseFlix's premium catalog. A CourseFlix subscription unlocks the full video player; the course description, table of contents, and preview information are available to everyone.
Where can I watch Eloquent Performance Patterns online?
Eloquent Performance Patterns is available to watch online on CourseFlix at https://courseflix.net/course/eloquent-performance-patterns. The page hosts every lesson with the integrated video player; no download is required.