Skip to content

Batch processing (findEach / findInBatches) #1911

Closed

Description

@bpamiri

Phase 1 — Modernization Target #6

Process large datasets without loading everything into memory.

Design

// Process records one at a time
model("User").findEach(batchSize=1000, callback=function(user) {
    user.sendReminderEmail();
});

// Process in batches
model("User").findInBatches(batchSize=500, callback=function(users) {
    processUserBatch(users);
});
  • Add findEach() to model/read.cfc — internally paginates using findAll(page=n, perPage=batchSize)
  • Add findInBatches() — passes entire query to callback
  • Use primary key ordering by default for consistent pagination
  • Support where, include, and order parameters

Backwards Compatibility

Purely additive new methods.

See design_docs/MODERNIZE-WHEELS-RIM.md §4.6 for full implementation plan.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions