Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

LAMP server: Fedora Core release 6

Using phpMyAdmin, I have added a new field to a database table. The datatype is int with a default of 0. This table has approx 5 million rows.

Since I submitted the phpMyAdmin form to add the field, Firefox waited for about 30mins then gave up saying the connection was reset. I submitted the form around an hour ago. If I try to access phpMyAdmin again, Firefox just loads forever.

There is a php/mysql web app running which works but is slow.

Using the top command, I can see that the CPU usage for PHP and MySQL are around:

php     35%
mysqld  20%

I suspect that MySQL is still in the process of adding the field, due to the huge amount of records and having to set default=0 on each. Does that sound correct?

I was looking for some thoughts on what to do/what not to do in this scenario. Do I just wait it out or should I try rebooting the server? I'm concerned if I reboot, the table might crash and lose the data.

Edit: I can now access phpMyAdmin no problem and view the table, all looks fine, but the CPU usage is now:

php      60%
mysqld   0.7%

Surely this is not normal CPU usage for php?

share|improve this question
    
What's PHP doing? That could certainly be normal if you have a lot of PHP scripts that use a lot of CPU. –  David Schwartz Apr 18 '12 at 12:05
    
Could be that php is now running all the tasks that were hung waiting for mysql to finish building the table. –  Patrick Apr 18 '12 at 12:13
    
David & Patrick thanks for the responses. The PHP and MySQL CPU usage has now dropped to 0. Everything looks OK now.... I will monitor it though. –  ServerBloke Apr 18 '12 at 12:20
    
40 mnutes? 5 million rows, adding a 0? I dont know too much MySql (nonte, sql server person) but that sounds like a lot of time, unless the wrows are very broad and the disc subsystem REALLY bad (consumer grade super slow disc). Even when rewriting the whole table and indices is shold not take that long. 30 minutes is a long time. –  TomTom Apr 18 '12 at 12:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.