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 > DB2 > insert question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-05, 04:37
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
insert question

Hi All !

I would like to know what would be the performance trade off in using a
INSERT INTO....SELECT ....(mass insert)
versus
Loop the SELECT and INSERT statements (one insert at a time)

By looping a select stmt followed by a insert, I can see the benefit of issuing intermittent commits.
In terms of performance, how does the masss insert compare with a SELECT-INSERT loop ? Any article to read more on this topic.


Anil
Reply With Quote
  #2 (permalink)  
Old 11-15-05, 06:29
juliane26 juliane26 is offline
Registered User
 
Join Date: Oct 2005
Posts: 109
Performance wise the mass insert will always be better,

only when having problems with logging and locking space (as you said already, commit counts), I would loop.

if you have a lock/log space problem, another option would be to load from a cursor.
__________________
Juliane
Reply With Quote
  #3 (permalink)  
Old 11-15-05, 07:55
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
You can split it up and still use your INSERT... SELECT.

See this thread:
http://www.dbforums.com/t1201769.html
__________________
--
Jonathan Petruk
DB2 Database Consultant
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