Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006

    Unanswered: Any Faster Way to Add Columns?

    It takes almost 3 hours to add 20 odd columns to a table of about 8 million records. Each operation Alter Table Add Column takes about 7 minutes, so 20 odd such operations take 3 hours.

    A faster way I think of is :
    To add columns to table A of 8 million records,
    1. create a temporary table B with schema same as table A.
    2. copy all data from table A to table B.
    3. CLRPFM table A
    4. alter table A.
    5. copy all data from table B to table A.

    But this method seems cumbersome and need to handle foreign keys etc.

    Is there any better and faster way to accomplish the task?

    Thank you!

    DB2 on AS/400 (V5R1)
    Running on 5250 Session.

  2. #2
    Join Date
    Aug 2001
    Why not add all 20 columns in one statement ?

    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Apr 2006
    Oops, learn the syntax now. Thank you!

Posting Permissions

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