ToysMall
V2EX  ›  问与答

MySql5.6 2000 万行, 5G 数据 , alter table 列类型大概需要多长时间?

  •  
  •   ToysMall · Oct 8, 2015 · 3064 views
    This topic created in 3899 days ago, the information mentioned may be changed or developed.
    6 replies    2015-10-09 11:39:00 +08:00
    hellojinjie
        1
    hellojinjie  
       Oct 8, 2015
    还不如先 select into outile
    然后重建表
    然后再 insert into from file
    kslr
        2
    kslr  
       Oct 8, 2015 via Android
    几个小时,如果列不是很多的话
    nowcoder
        3
    nowcoder  
       Oct 8, 2015
    20 分钟左右
    msg7086
        4
    msg7086  
       Oct 9, 2015
    @hellojinjie alter table 就是这个过程,而且少个序列化。
    hellojinjie
        5
    hellojinjie  
       Oct 9, 2015
    @msg7086 直接 alter 应该还有锁表这一个过程,还有包括事务、日志相关的操作,所以应该会更耗时一些。如果直接 alter ,也有可能会报缓存不足的错误的。
    msg7086
        6
    msg7086  
       Oct 9, 2015
    @hellojinjie 没记错的话应该是先做 copy to temp table 然后再重做索引。不太清楚你说的那几个。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3648 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 79ms · UTC 04:35 · PVG 12:35 · LAX 21:35 · JFK 00:35
    ♥ Do have faith in what you're doing.