Laravel withCount() VS WithExists(): Same Performance?

Laravel withCount() VS WithExists(): Same Performance?

Laravel Daily

54 года назад

6,277 Просмотров

I think a lot of you know and use the withCount() function, but there's also a withExists() to check for related records. But is it faster? Let's try it out.

Official docs: https://laravel.com/docs/9.x/eloquent-relationships#aggregating-related-models

- - - - -
Support the channel by checking out my products:
- My Laravel courses membership: https://laraveldaily.teachable.com/p/all-courses-yearly-membership?utm_source=youtube&utm_campaign=withcount-withexists
- Laravel QuickAdminPanel: https://bit.ly/quickadminpanel
- Livewire Kit Components: https://livewirekit.com

- - - - -
Other places to follow:
- My weekly Laravel newsletter: http://bit.ly/laravel-newsletter
- My personal Twitter: https://twitter.com/povilaskorop
Ссылки и html тэги не поддерживаются


Комментарии: