1

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.

2

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.

2
SHOW PROCESSLIST;  -- to see if it is still running
SHOW PROCESSLIST;  -- might give an indication of something blocking it
SHOW CREATE TABLE ...;  -- should show the index (or not)
  • if scripting there's also SHOW INDEX FROM .... – danblack Feb 28 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.