#5: Database Chunking | 🚀 Quick Laravel Performance Tips 🚀
HTML-код
- Опубликовано: 1 окт 2024
- If you need to process a big database query, Then you must use the chunk method. This chunk method will fetch a "chunk" of the Eloquent collection. Using the chunk method will reduce memory usage when working with large result sets.
🚀 𝗤𝘂𝗶𝗰𝗸 𝗟𝗮𝗿𝗮𝘃𝗲𝗹 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝗧𝗶𝗽𝘀 𝗣𝗹𝗮𝘆𝗹𝗶𝘀𝘁:
• 🚀 Quick Laravel Perfor...
*Don't get left behind! Try Spec Coder: Supercharge Your Coding with AI!*
👉 qirolab.com/spec-coder
Hi QiroLab, how to solve max_execution_time and memory_limit issue together? When I try to chunk the collection, it goes timeout for me.
QiroLab what are you using to see your queries on the Chrome dev tools?
I have installed the Laravel Debugbar package. Here in this video you can see how I installed this package in Laravel Project.
ruclips.net/video/N0phQbyzF0I/видео.html
thanks
@@randyharsh3046 You’re welcome.
Yes, but who ever will show 100000 entities on a single page? I think Laravel paginate() method solves this problem.
Yes, you are right. No, one will show 100000 records on a single page. But there are much other use cases where you may need to fetch 100000 records. For example, you may need for report generating like analytics, or to update each record for some reason, or you may need to send a notification to 100000 users or you may need to clean up some records based on some conditions. There are many many use cases where you may need to fetch 100000 records.
Hi, I have questions regarding laravel query,
I have a open profile search platform with all of this field-
No of records you want - required
Job title - optional
City - optional
State - optional
Country - optional
1. First time I have searched 25000 records
2. Second time same 25000 records
and so on or may be different number with different fields
Note: I need unique records on every search that's by I am creating and history table for this with comma separated profile ids but it's failed when I will reach 100000 previous search records eliminate from profile table. One another thing I am using previous records eliminate using where not in..
Do you have any solution for this?
what if you wanted to use pagination with chuck all together
Еще раз большое спасибо за Ваши классные уроки!
good explanation
This helps a lot... Thanks