improve performance of aggregate journals migration

The purpose of the rather low batch size (the default is 1000) does no longer apply. It was important before the journals where cast to an array in the next line.
pull/9475/head
ulferts 3 years ago committed by Oliver Günther
parent ab940052b7
commit b3bd780c2c
  1. 2
      db/migrate/20210615150558_aggregate_journals.rb

@ -25,7 +25,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]
# The change is irreversible (aggregated journals cannot be broken down) but down will not cause database inconsistencies.
def aggregate_journals(klass)
klass.in_batches(of: 20) do |instances|
klass.in_batches do |instances|
# Instantiating is faster than calculating the aggregated journals multiple times.
aggregated_journals = aggregated_journals_of(klass, instances).to_a

Loading…
Cancel
Save