Eloquent Performance Patterns
In this series, you'll 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.
This course 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.
Series episodes
Techniques (6)
Measuring Your Database Performance
4m 43sLearn how to measure your database’s performance effectively—gain insights to optimize queries and avoid flying blind in your app’s data management.
Minimize Memory Usage
4m 29sLearn how to minimize memory usage by selecting only the data you need from the database—boost your app’s efficiency with smart, lean queries today!
Getting One Record From a Has-Many Relationship
9m 38sLearn how to efficiently fetch one record from a has-many relationship using database subqueries—boost your Laravel app’s performance with smart querying techniques!
Dynamic Relationships Using Subqueries
6m 9sTake your Eloquent skills further by mastering dynamic relationships with subqueries—optimize has-many queries and boost your Laravel app’s efficiency today!
Calculate Totals Using Conditional Aggregates
4m 20sLearn how to calculate totals with conditional aggregates in your database using a demo app that tracks customer feature requests—boost your data skills today!
Optimize Circular Relationships
4m 25sMaster optimizing circular relationships in Eloquent using setRelation() to manually eager load and boost your Laravel app’s performance with ease.
Search Feature (6)
Multi-Column Searching
4m 6sLearn how to build a powerful multi-column search using simple string matching and the SQL LIKE operator—boost your app’s search functionality today!
Getting LIKE to use an Index
5m 6sOptimize your search queries by learning how to get LIKE to use indexes effectively. Join this Laracasts episode to boost your database performance with smart tips!
Faster Options Than whereHas
3m 54sBoost your query speed by fixing index issues! Explore faster alternatives to whereHas in this Laracasts lesson and optimize your database performance today.
When it Makes Sense to Run Additional Queries
3m 10sExplore when running multiple database queries makes sense and how it can outperform subqueries. Boost your Laravel skills with this practical Laracasts lesson!
Use Unions to Run Queries Independently
8m 1sLearn how to run multiple queries independently within a single database call using unions. Boost your database skills with this clear, friendly Laracasts lesson!
Fuzzier Searching With Regular Expressions
4m 48sEnhance your search skills! Learn how to use regular expressions with virtual indices for fuzzier, smarter searches in this engaging Laracasts lesson.
Performance (16)
Run Authorization Policies in the Database
6m 7sDiscover how running authorization policies in the database can boost security and efficiency. Join this Laracasts episode for practical, expert insights!
Faster Ordering With Compound Indexes
4m 7sBoost your query speed with compound indexes! Learn how to optimize orderBy performance in this Laracasts lesson with clear, practical examples.
Options for Ordering by a HasOne Relationship
1m 41sLearn two ways to order Eloquent records by a hasOne relationship and pick the most performant approach for your Laravel app.
Options for Ordering by a BelongsTo Relationship
1m 42sOrder Eloquent results by a belongsTo relationship column—practical, step-by-step tips to sort Laravel queries efficiently.
Options for Ordering by a HasMany Relationship
4m 24sMaster ordering records by a hasMany relationship: compare joins vs subqueries and learn practical strategies to sort related data efficiently.
Options for Ordering by a BelongsToMany Relationship
4m 24sLearn how to order records by a belongsToMany relationship (library checkout example) with practical Eloquent strategies and examples.
Ordering With NULLs Always Last
7m 39sLearn to order query results with NULLs last: practical SQL techniques and examples to ensure null values appear at the end of your lists.
Ordering By Custom Algorithms
6m 40sLearn to sort records with custom algorithms—implement flexible ordering (title, status, activity) to display feature requests intuitively.
Filtering and Sorting Anniversary Dates
7m 7sLearn how to filter, sort, and order data by anniversary dates like birthdates to organize user lists effectively in this practical Laracasts lesson.
Make N+1 Issues Impossible
3m 36sLearn a simple technique to prevent N+1 query issues from ever affecting your app’s performance in this clear, practical Laracasts lesson.
Ordering Data For Humans Using Natural Sort
4m 23sLearn natural sorting to order data for humans—practical examples and techniques to make lists read and sort intuitively.
Full Text Searching With Rankings
5m 9sLearn to implement MySQL full-text search with relevance rankings, create indexes, run queries, and boost search accuracy in your apps.
Get the Distance Between Geographic Points
3m 25sLearn to compute accurate distances between geographic points using geospatial functions, a step-by-step guide for practical location-based apps.
Filter by Geographic Distance
3m 2sLearn to filter geographic points to show only results within 10 km, hands-on distance queries and geospatial filtering for your web app.
Order by Geographic Distance
1m 28sLearn how to order locations by geographic distance to display the closest stores first. Enhance your app with smart, location-based sorting techniques!
Filter by Geospatial Area
4m 38sLearn how to filter results by geospatial area with a demo app mapping customer locations across Canada. Master location-based queries with ease and precision!




