Database migration (Restore phase) does not implement batch updates

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Database - Migration
    • None
    • 8
    • 4

      Problem Definition

      The database migration executes the INSERT statements one at a time, which is inefficient due to multiple trips to the database. This causes a bottleneck on the migration because the database inserts cannot keep up with the processing of the changeset content.

      The bottleneck is more apparent in SQL Server as the target database, with migrations taking 2.5x longer compared to Postgres.

      Suggested Solution

      Implement batch updates with Statement.executeBatch

      Sample implementation for SQL Server: https://learn.microsoft.com/en-us/sql/connect/jdbc/use-bulk-copy-api-batch-insert-operation?view=sql-server-ver15

      Why This Is Important

      By using batch updates, local tests reveal that it can reduce migration time by 85.37% for Postgres, and 94.29% for SQL Server. 

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

            Assignee:
            Unassigned
            Reporter:
            Aedrian Escultura (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: