```ruby
grouped_children = filter(foreign_key => ids).limit(1000000).group_by(&foreign_key.to_sym)
records.each do |record|
  children = grouped_children.fetch(record.id || [])
  record.send(to_load).eager_loaded(children)
end
```