Results 1 to 3 of 3

Thread: insert question

  1. #1
    Join Date
    Feb 2005
    Posts
    118

    Unanswered: 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

  2. #2
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •