MySQL insert query cannot finish

Go To StackoverFlow.com

2

I am inserting part of a large table to a new MyISAM table. I tried both command line and phpmyadmin, both take a long time. But I find in the mysql data folder, the table file actually has GB of data, but in phpmyadmin, it shows there is no record. Then I "check" the table, and it takes like forever...

What is wrong here? Should I change to innoDB?

2012-04-05 03:11
by DrXCheng
mysql generally won't shrink the db files, even if you've deleted all the data from them. expanding the files later on is a relatively "expensive" operation - Marc B 2012-04-05 04:08


0

Do you have indicies defined on your table? If you're most interested in inserting a lot of data quickly, you could consider dropping the indicies, doing the insert, and then re-adding the indicies. It won't be any faster overall (in fact the manual intervention would likely make the overall operation slower), but it would give you more direct visibility into how long the data insertion is taking versus the indexing that follows.

2012-04-05 03:21
by AJ.
I have almost all the field indexed. Basically I am doing some pre-processing, so if it takes a few hours it is okay. But it seems taking forever. And I am doing "group by" to aggregate the data and insert, so I think indicies are necessary - DrXCheng 2012-04-05 04:11
Are you able to run 'show processlist' to see what query(ies) are running - AJ. 2012-04-05 13:56
Yes. I can see that - DrXCheng 2012-04-10 16:23
Ads