mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 21:34:03 +00:00
11 lines
No EOL
681 B
Markdown
11 lines
No EOL
681 B
Markdown
---
|
||
title: 'You can use constrained eager loading to increase performance of database queries that use relations'
|
||
tweet_id: '1509994025926885381'
|
||
thread_slug: weekly-thread-2022-13
|
||
author_username: mattkingshott
|
||
images:
|
||
- 'https://pbs.twimg.com/media/FOsQc3JXEAgF1P6.jpg'
|
||
created_at: 2022-04-01T20:40:04+00:00
|
||
slug: you-can-use-constrained-eager-loading-to-increase-performance-of-database-queries-that-use-relations
|
||
---
|
||
🔥 #Laravel Tip: Eager loading a model’s relationships is a great way to improve performance / avoid the N+1 problem. However, you can go further… with constrained eager loading you can tell Laravel to only load the related records you actually need. |