Y
Y
yurygolikov2017-04-16 15:11:25
MySQL
yurygolikov, 2017-04-16 15:11:25

Is it possible to somehow disable and enable indexes in MySql 5.7 in InnoDB for large data inserts?

What are the ways to disable and enable indexes, including full text ones in MySql 5.7 - InnoDB ?
If the option below in InnoDB - does not work. The inserts will be relatively massive, so I don't want the indexes to be recalculated each time. Please do not scold me, I'm from MySQL to "you". Thank you.
ALTER TABLE officials DISABLE KEYS;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arthur Asatryan, 2017-04-16
@yurygolikov

You can't with InnoDB, but you can with MyISAM.
1. Make sure you have a batch insert and not one at a time.
For example
But not

INSERT INTO my_table (a,b,c) VALUE(1,2,3);
INSERT INTO my_table (a,b,c) VALUE(4,5,6);
INSERT INTO my_table (a,b,c) VALUE(7,8,9);

2. Some tricks here https://dev.mysql.com/doc/refman/5.7/en/optimizing...
3. Read more here stackoverflow.com/questions/5613756/mysql-pause-in...

D
Dmitry Dart, 2017-04-16
@gobananas

ALTER TABLE db.my_table DISABLE KEYS;
// Вставка больших данных
ALTER TABLE db.my_table ENABLE KEYS;

Just do not use it often and do not forget that reading at this moment is essentially impossible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question