If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Batch Insert Issue with Mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-09, 12:55
lovesky202005 lovesky202005 is offline
Registered User
 
Join Date: Nov 2009
Posts: 3
Batch Insert Issue with Mysql

Hello everyone,

I am a newbie to this community and am quite impressed by the discussions carried out.

So, I just thought this would be the right place to ask SQL doubts although the problem is with MySQL.

My problem is:

I need to insert thousands of records in 2 tables A, B.
Now table A has a column index_no, an auto-incrementing column.

When I insert any row in table A, I want that the row in table B should be inserted using the index_no in table A.

One approach that I am using is,

Insert a record in table A, get the Index_No value and insert the record in table B with this index_No.

However for every set of records, there are 3 queries being executed -- insert in A,select from A and insert in B.

For 10000 records, this figure is 10000*3 = 30000.

Is there any better way to do it. (like LOAD LOCAL DATA in FILE)

Thanks
Akash
Reply With Quote
  #2 (permalink)  
Old 11-19-09, 13:20
lovesky202005 lovesky202005 is offline
Registered User
 
Join Date: Nov 2009
Posts: 3
Any help?????
Reply With Quote
  #3 (permalink)  
Old 11-19-09, 15:45
Fakin Fakin is offline
Registered User
 
Join Date: Sep 2009
Posts: 39
you can use a ETL.

for example pentaho.

Pentaho BI Suite 3.5 will help you escape proprietary BI!

in tools you have function for auto increment, and you can insert in few tables one columns or whole record.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On