Is it better to create an index before filling a table with data, or after the data is in place?

后端 未结 5 1500
遥遥无期
遥遥无期 2020-12-07 19:37

I have a table of about 100M rows that I am going to copy to alter, adding an index. I\'m not so concerned with the time it takes to create the new table, but will the crea

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 20:33

    Indexes created after are much faster in most cases. Case in point: 20 million rows with full text on varchar(255) - (Business Name) Index in place whilst importing rows - a match against taking up to 20 seconds in worst cases. Drop index and re-create - match against taking less than 1 second every time

提交回复
热议问题