Jump to content

large bulk insertion in mysql problem


Recommended Posts

I am reading data from CVS file and then inserting them with bulk insert query in MYSQL DB because i have rows in 10 thousands. The problem i am facing is, whenver i do bulk insert using PHP , it only insert 136 rows. This number of rows insertion remains same whatever the size of CSV rows are. I increased 

 the values of max_execution_time , memory_limit using php_ini as well as from .htaccess but to no avail. I understand there is some setting which is causing insertion of only fixed number of rows but unable to find exact parament. Anyone can help me out what i need to do for bulk insertion in mysql DB using PHP when isertion rows are in ten thousand or 15 thousands.

Link to comment
Share on other sites

it's likely that you are getting a query error at the 137th line in the csv file, either due to an un-escaped value in the data, a duplicate key error, an empty numerical data value, an incorrectly formatted line in the data, or ...

 

does your code have any sort of error checking logic in it to detect query errors? have you looked at the 137th line of data to see if there's something about it that's different and unexpected?

 

edit: here's a post listing methods for inserting bulk data - http://forums.phpfreaks.com/topic/294621-importing-legacy-data-into-mysql/?do=findComment&comment=1505730

Link to comment
Share on other sites

Can you post the contents of the CSV file from lines ~130 to ~140? Where are these CSV files generated from. You state there is no error, but simple things (missing comma for instance) can easily be missed. If these files are all coming from the same source process, there could be an error in that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.