Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-20172

Database migration (Restore phase) does not implement batch updates

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • Database - Migration
    • None
    • 2
    • 2
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      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

              Unassigned Unassigned
              aaff5594b3eb Aedrian Escultura (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: