bulk insert with or without index

后端 未结 3 2074
灰色年华
灰色年华 2021-02-20 16:58

In a comment I read

Just as a side note, it\'s sometimes faster to drop the indices of your table and recreate them after the bulk insert operation.

<
3条回答
  •  無奈伤痛
    2021-02-20 17:02

    As with Joel I will echo the statement that yes it can be true. I've found that the key to identifying the scenario that he mentioned is all in the distribution of data, and the size of the index(es) that you have on the specific table.

    In an application that I used to support that did a regular bulk import of 1.8 million rows, with 4 indexes on the table, 1 with 11 columns, and a total of 90 columns in the table. The import with indexes took over 20 hours to complete. Dropping the indexes, inserting, and re-creating the indexes only took 1 hour and 25 minutes.

    So it can be a big help, but a lot of it comes down to your data, the indexes, and the distribution of data values.

提交回复
热议问题