How long does MySQL take to create an index?

How long does MySQL have to build a table index with 30,000,000 records, which are 256 rows long? The clock seems to be running out at the moment, and I don’t know how long I have to wait until I decide that MySql just could not create the index.

+3
source share
3 answers

You can run SHOW PROCESSLIST \Gmysql in the console to view its status. I had a similar problem just a couple of hours ago, but my desk was much smaller.

Here is a list of thread states that you will definitely need. After an hour of waiting, I realized that I ALTER TABLE CREATE INDEXwas in a state Locked, I need to restart mysqld and run the statement again. At that time, I had an index built in 15 minutes.

By the way, I recommend starting the creation of the index from the mysql console, GUI tools can add some processes to the process.

+2
source

it may take several hours. it all depends on the characteristics of the machine, boot, etc., to see if it worked, check something like topor look at your hard drives - if they go crazy, it still indexes.

0
source

(.. / DB), , .

0

Source: https://habr.com/ru/post/1740463/


All Articles