Jump to content

Bulk/Batch Many thousands of records into a Table


davidu

Recommended Posts

Hi there,

 

I am using MYSQL version 5.1

 

I need to be able to batch insert possibly many thousand of records into a single table.

I want to use PDO and have considered possibly binding the values with bind_param of bind_values.

 

However, surely it would be better for me to build up a string of either 1 or many records with parentheses as elements of an array and then pass to a user defined bulk insert record class. This would then use implode to separate the record with commas.

 

eg.

 

INSERT INTO TABLEA (Col1, Col2 ....)

VALUES

(record 1),

(record 2)

......

 

What is the essential difference between bind_param of bind_values ?

 

I can't use bind_param or bind values here can I because I would have to loop round the individual recs to bind the recs or can the values from multiple records be bound to the insert cols in 1 pass?

 

Many thanks for your help.

Edited by davidu
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.