lib/zdm.rb
# Drop indexes to speed up copy_in_batches.
#
# "Online DDL support for adding secondary indexes means that you can
# generally speed the overall process of creating and loading a table
# and associated indexes by creating the table without any secondary
# indexes, then adding the secondary indexes after the data is loaded."
# https://dev.mysql.com/doc/refman/5.7/en/innodb-create-index-overview.html#idm140602200949744
Drop indexes to speed up copy_in_batches.
Drop indexes to speed up copy_in_batches .
def drop_copy_indexes
        @indexes = connection.indexes(table.copy).reject(&:unique)
        @indexes.each do |index_def|
          execute('ALTER TABLE `%s` DROP INDEX `%s`' % [table.copy, index_def.name])
        end
      end
def drop_copy_indexes @indexes = connection . indexes ( table . copy ) . reject ( & :unique ) @indexes . each do | index_def | execute ( 'ALTER TABLE `%s` DROP INDEX `%s`' % [ table . copy , index_def . name ] ) end end
Drop indexes to speed up copy_in_batches.
Drop indexes to speed up copy_in_batches .