各位老哥,小弟请教个问题,我有张mysql数据表,里边大概6W条记录,现在有个varchar类型字段改成int类型,该字段有建立索引的,我是不是应该先删除索引再改字段类型?或者有更好的方法?
高洛峰2017-04-17 16:06:43
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!