Is there any way to see the progress of an ALTER TABLE statement in MySQL?

In the case of InnoDB tables, one can use SHOW ENGINE INNODB STATUS to find the transaction doing the ALTER TABLE and check how many row locks the TX holds. This is the number of processed rows. Explained in detail here:

http://gabrielcain.com/blog/2009/08/05/mysql-alter-table-and-how-to-observe-progress/

Also MariaDB 5.3 and later has the feature to report progress for some operations (including ALTER TABLE). See:

http://kb.askmonty.org/en/progress-reporting/


This is a pretty common request apparently - requested as far back as 2005 on bugs.mysql.com. It exists in Oracle already, and is listed as useful, but "it is not a simple thing to do, so don't expect it to be implemented soon.". Although that was 2005 :)

That said, the chap who asked the original question later released a patch for MySQL 5.0, backported to 4.1, which might help you out.


I was able to perform these 2 queries and figure out how many rows remain to be moved.

select count(*) from `myoriginalrable`;
select count(*) from `#sql-1e8_11ae5`;

this was WAY more helpful than comparing the file size on disk, because changing from myisam to innodb etc changes the row size.

Tags:

Mysql