SonarSource / mysql-migrator

Command line tool to migrate MySQL database of SonarQube 6.7-7.8 to non-MySQL
39 stars 11 forks source link

Excessive memory use by MySQL driver #37

Closed ghost closed 5 years ago

ghost commented 5 years ago

When a table has gigabytes of data, the migration crashes with out of memory error. Even though records are expected to be committed in the target database in batches of 5000, the target table remains empty.

Cause: by default the MySQL JDBC driver fetches all records before streaming them to ResultSet.next calls. See more details in this thread.

Solution: set fetch size to Integer.MIN_VALUE on the Statement that selects the rows to copy.