MySQL Query, bulk insertion

我的梦境 提交于 2019-12-11 17:14:40

问题


I have a bulk data for insertion in MYSQL Tables, let use suppose, 10k in one time, What I am doing is store the data in an XML file and then go for insertion (data is around 50K rows), It will take a lot of time, Is there any option for bulk insertion in MySQL tables.

Thanks in advance,
Please help.


回答1:


LOAD DATA INFILE can help. It is the fastest way to load data from text file.




回答2:


You may also want to disable de indexes before insertion and enable them afterwards to recreate them.

ALTER TABLE ... DISABLE
ALTER TABLE ... ENABLE KEYS



来源:https://stackoverflow.com/questions/672386/mysql-query-bulk-insertion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!