The ipoid database needs to be updated daily with new data for that day. To do this we diff yesterday's data and today's data, and produce a .sql file for the changes that need to be made. The file typically contains millions of statements.
Following T344272: Use batching for daily data import, the .sql file is processed in batches, in order not to use up database resources. Batches are created by splitting the file into smaller files with n lines. However, some of the statements have dependencies. Currently, there is no guarantee that dependent statements are in the same batch, so if one batch fails, it might cause subsequent batches to fail.
We should ensure that dependent statements are in the same batch.