Mysql – How to know if an index has been successfully created in MySQL

indexMySQL

I use Capistrano to deploy a Rails app. Capistrano handles running database migrations via essentially a shell script that runs from my local computer.

About 24 hours ago I started a migration that added a compound index to my table (on 3 columns, to be specific, and 9 million records). I returned to my office this morning and the script still hadn't completed.

However, at this point, I have no idea if it's just that my local connection to the database timed out, even though it continued processing the index.

My question is, how do I know if the indexing process has completed?

When I view the table via a MySQL client (Sequel Pro), I do see the indexes listed (with cardinality equal to the correct number of rows). But I'm not sure if these would be listed anyway as part of the initial creation of the indexes.

Best Answer

Welcome.

If you say that the script did not finish / exit...

One crude method to find if the indexing process is in the middle...

You shall try listing the folder contents of /var/lib/mysql/dbname/ and checking the date and time of update of the table names concerned. If the date/time does not change for a while you shall be sure that the process is not touching that table file for as much time. Hence cornering if there is a process snap due to timeout or other.