Optimize link repository ID migration (14.4)
This backports !4234 (merged) to 14.4. 14.5 and 14.6+ already received this change.
The previous migration was slow at times because the update would cause
PostgreSQL to do a merge join and then filter out rows matching
repository_id IS NULL
. As more rows migrated gained a repository_id
,
this would increase the query time significantly for each batch.
The batching was added to deal with limiting the payload size of a trigger update.
We can make this migration go faster by disabling the triggers in the transactions, rollback to 2bbec66c, and re-enable the trigger.
Relates to #3973 (closed)
Edited by Stan Hu