Log in

No account? Create an account
entries friends calendar profile My Website Previous Previous Next Next
A working "progress bar" for a huge ALTER TABLE - Mark Atwood — LiveJournal
A working "progress bar" for a huge ALTER TABLE
3 comments or Leave a comment
From: (Anonymous) Date: September 22nd, 2009 09:29 pm (UTC) (Link)

TokuDB reports alter progress in show proceslist

The TokuDB storage engine from Tokutek reports progress on alter table operations in show processlist. For example, in one client session I started an alter table on a 50M row table:

mysql> select count(*) from shrink;
| count(*) |
| 50000000 |
1 row in set (19.45 sec)

mysql> alter table shrink engine=tokudb;

In a separate client session, show processlist reports progress:

mysql> show processlist\G
*************************** 1. row ***************************
Id: 85
User: mysql
Host: localhost
db: test
Command: Query
Time: 274
State: Inserted about 4281000 rows
Info: alter table shrink engine=tokudb
*************************** 2. row ***************************
Id: 87
User: root
Host: localhost
db: NULL
Command: Query
Time: 0
State: NULL
Info: show processlist
2 rows in set (0.00 sec)

Since both the number of rows processed and the total seconds are reported, it's easy to compute the average rows/sec so far. Since the rate may drop over time, you can run show processlist multiple times and use deltas to get an estimate of the current rate.
3 comments or Leave a comment