Zum Inhalt springen

Large Result Not Chunked (ARCH6062)

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

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

Loading an entire large result set into memory then iterating pulls millions of rows at once when a streaming/chunk API like find_each exists.

User.where(active: true).each do |user|
Mailer.notify(user).deliver_later # whole result loaded into memory
end
User.where(active: true).find_each(batch_size: 1000) do |user|
Mailer.notify(user).deliver_later
end

Iterate large results in chunks with find_each/in_batches instead of loading them all into memory.