MySql - WAMP - Huge Table is very slow (20 million rows)

后端 未结 3 1703
借酒劲吻你
借酒劲吻你 2021-02-20 10:19

So I posted this! yesterday and got a perfect answer, which required running this code first: ALTER TABLE mytable AUTO_INCREMENT=10000001;

I ran it several times, but r

3条回答
  •  我在风中等你
    2021-02-20 11:01

    It's going to take a long time because you've only got 2GB RAM and 6GB of data/indexes and it's going to force a ton of swapping in/out between RAM and disk. There's not much you can do about that, though.

    You could try running this in batches.

    Create a separate empty table with the auto_increment column included in it. Then insert your records a certain amount at a time (say, 1 state at a time). That might help it go faster since you should be able to handle those smaller datasets completely in memory instead of paging to disk.

    You'll probably get a lot better responses for this if it's on dba.stackexchange.com also.

提交回复
热议问题