mysql - 数据库批量插入数据的速度是否与索引有关?
伊谢尔伦
伊谢尔伦 2017-04-17 16:12:56
0
2
619

在数据库批量插入数据时,插入数据的速度是否与创建的索引有关?
如果有关请给出指相关文档,谢谢!

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
伊谢尔伦

Of course it will have an impact, and it will cause a simple update when inserting data. The more strings there are, the slower the insertion will be. See the document description
Although it can be tempting to create an indexes for every possible column used in a query, unnecessary indexes waste space and waste time for MySQL to determine which indexes to use. Indexes also add to the cost of inserts, updates, and deletes because each index must be updated. You must find the right balance to achieve fast queries using the optimal set of indexes.

小葫芦

Indexes have a great impact on batch insertion of data. The reason is very simple. On the one hand, the index needs to be written at the same time when writing the table. On the other hand, for unique indexes, it is necessary to check whether the data is duplicated.

For large batches of data import, the index is usually removed first, and then the index is rebuilt after the data import is completed.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template