如题,如果有一张表有一千万条数据,用update XX set XX=?
,最快的修改方式是什么? 行业数据

解决方案 »

  1.   

    最快的方式是导出数据  然后awk用xxx替换掉你那列 然后在导入
      

  2.   

    千万的数据整体UPDATE对效率的执行会很低的。
    建议分段update可以提高对磁盘I/O影响。
    update xx set xx=? where id between ... and ...
    update xx set xx=? where id between ....and ...
      

  3.   

    千万的数据整体UPDATE对效率的执行会很低的。
    建议分段update可以减少对磁盘I/O影响。
    update xx set xx=? where id between ... and ...
    update xx set xx=? where id between ....and ... 
      

  4.   

    这就是数据库设计不当的后果。应该一开始就把此字段设计成enum或set型;或者把数据值弄成一个代号。