Batch insertion of data to MySQL database using php

前端 未结 3 1221
抹茶落季
抹茶落季 2021-01-14 03:10

I have a thousands of data parsed from huge XML to be inserted into database table using PHP and MySQL. My Problem is it takes too long to insert all the data into table. Is

3条回答
  •  不思量自难忘°
    2021-01-14 04:09

    Yes, just do what you'd expect to do.

    You should not try to do bulk insertion from a web application if you think you might hit a timeout etc. Instead drop the file somewhere and have a daemon or cron etc, pick it up and run a batch job (If running from cron, be sure that only one instance runs at once).

提交回复
热议问题