AETERNAE AI RESEARCH LLC INDEPENDENT RESEARCH
ÆAETERNAERESEARCH
Sign inRequest access
← Malware catalog

Attributed metadata history

REPORTPUBLIC METADATA

I Fixed My Slow Laravel App With 4 Eloquent Changes — Here's What Actually Helped

My Laravel app worked fine for months. Then the users table passed 50,000 rows, the posts page started taking four seconds to load, and a nightly export job started dying with "Allowed memory size exhausted" at 3 a.m. I did not rewrite the app. I did not add Redis. I changed four Eloquent habits, and the same pages got fast again. Here is what actually helped, in the order that mattered most. 1. Eager loading fixed the biggest slowdown The posts page looped over posts and read $post->user->name inside the loop. That is the classic N+1 problem: one query for the posts, then one extra query per post. With 100 posts, the page ran 101 queries. // Before: 101 queries $posts = Post::all(); // After: 2 queries $posts = Post::with('user')->get(); One word — with('user') — cut the page load from four seconds to under half a second. If your page touches a relationship inside a loop, this is always the first thing to check. Laravel Telescope shows the query count per request, which makes the problem impossible to miss once you look. 2. exists() instead of count() for simple checks My code checked whether an email was already registered with count() > 0. That counts every matching row before answering a yes-or-no question. exists() stops at the first match: // Counts ALL matching rows User::where('email', $email)->count() > 0 // Stops at the first match User::where('email', $email)->exists() It is a one-word change, and on a busy table it is the difference between scanning thousands of rows and stopping at the first one. 3. Chunking fixed the memory crash The nightly export used User::all() and tried to build 50,000 model objects in memory at once. chunk() processes 500 rows at a time and frees the rest: User::chunk(500, function ($users) { foreach ($users as $user) { // export 500 users, then move on } }); The job has not run out of memory since. If the data can change while the job runs, chunkById() is the safer version because it pages by primary key instead of offset. 4. Let the database do the maths A dashboard page loaded every completed order into PHP just to sum the totals. The database can return one number instead of ten thousand rows: // Loads every order, sums in PHP Order::where('status', 'completed')->get()->sum('total'); // The database returns a single number Order::where('status', 'completed')->sum('total'); Same rule for count(), avg(), min() and max(): if the answer is one number, never fetch the rows to compute it. What I learned Slow Eloquent is almost never about the framework being slow. It is about asking the database for work you do not need: extra queries in a loop, whole tables in memory, counting rows you only wanted to check. Fix those four habits first, and measure before and after — Telescope will show you the improvement in one number. I wrote up the full list of 10 tips, with the rest of the fixes (query scopes, withCount(), firstOrCreate, caching and more) here: https://rajadevsolutions.online/blog/laravel-eloquent-tips-and-tricks What is the slowest Eloquent query you have fixed? I would love to hear what it was.

Reference details

Source category
research-report
First reported
Nov 26, 2026 17:40 UTC
Last reported
Nov 26, 2026 17:40 UTC
Catalog updated
Nov 26, 2026 17:53 UTC
Record ID
1a5b3dafc00c53cd77e2f686d8a3d77fd571a4e1e9b6318575d119d19385e38a

Published indicators

Network indicators are visibly defanged. This page does not make them clickable or send them to another service.

No validated file hashes or network indicators are stored for this record.

Source observations

intelligence_src_6dc544294b7f21f98a

Source-provided label
Publisher RSS metadata
Evidence class
mentioned in report
Confidence
Not reported
Observed
Nov 26, 2026 17:40 UTC
Retrieved
Nov 26, 2026 17:53 UTC

This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.

Feed collection status

Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.

1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.

Review source update dates and status
  • intelligence_src_6dc544294b7f21f98aRecent successful batchLast successful batch: Last attempt:

Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.