performance - MySQL change column name on EMPTY table, takes very long -
running local mysql instance. in db, misspelled column name (stret street). wrote query:
alter table address alter stret street varchar(20);
this table has been created , contains 0 records. know there various threads asking why take long of tables has 100,000+ rows. have nothing! why did query take 1 hr 13 min 15.76 sec?
i know have dropped , recreated table, curious why "simple" alter take long?
edit: found out reason. debugging programme uses db , stopped in middle (without terminating program) alter column name. 1 time stopped tomcat instant again. presumably table locked query held up. using innodb. everyone.
before might want truncate table address
(very fast reset auto_increment
column counters) or optimize table address
(a bit slower, doesn't alter data) in order flush out left-over info deleted not vacuumed database.
an alternative create table _address address
, run alteration clone, switch _address
address
using rename table
.
mysql performance
No comments:
Post a Comment