mysql优化 - mysql修改字段类型问题
PHP中文网
PHP中文网 2017-04-17 16:04:43
0
1
640

各位老哥,小弟请教个问题,我有张mysql数据表,里边大概6W条记录,现在有个varchar类型字段改成int类型,该字段有建立索引的,我是不是应该先删除索引再改字段类型?或者有更好的方法?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
小葫芦

First of all, try not to change the data structure as much as possible
Secondly, if you have to change it, please back up the data first to prevent accidents
Finally, "should the field be deleted from the index first and then the field type changed?" I'm afraid it depends on what kind of index it is. . . .
The most direct way is to create a new table and then import the data

To add: Actually, there is no better way, just try it!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template