Zum Inhalt springen

Large Result Not Chunked (ARCH7062)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key php.orm.large-result-not-chunked · Severity info · Category orm

Loading an entire large result set into memory then iterating risks holding millions of rows at once when a streaming/chunk API (chunk, cursor) exists. Chunked processing keeps memory bounded.

<?php
foreach (User::all() as $user) { // all rows into memory
export($user);
}
<?php
User::chunk(1000, function ($users) { // chunk by chunk
foreach ($users as $user) {
export($user);
}
});

Process large result sets in chunks/streams with chunk/cursor.