Merging two very large tables

Discussion in 'MySQL' started by jokershouse, Jul 15, 2007.

  1. #1
    I have two tables in a database,

    one has 250k records, and the other has 1 mil records. I need to add the 250k one in with the 1 mil. They both have the same sturcture...anybody know how to do this?

    Thanks in advance
     
    jokershouse, Jul 15, 2007 IP
  2. infonote

    infonote Well-Known Member

    Messages:
    4,032
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    160
    #2
    If you are using MySql

    dev.mysql.com/doc/refman/5.0/en/merge-storage-engine.html
     
    infonote, Jul 15, 2007 IP
  3. coldfire7

    coldfire7 Peon

    Messages:
    504
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #3
    which DBMS are u using ?
     
    coldfire7, Jul 19, 2007 IP
  4. amf-flt

    amf-flt Active Member

    Messages:
    100
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #4
    INSERT INTO destination SELECT * FROM source

    Something like that should pretty much take care of adding the records from one table into another.
     
    amf-flt, Jul 20, 2007 IP
  5. purdue512

    purdue512 Well-Known Member

    Messages:
    858
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #5
    That is correct:

    INSERT INTO destination SELECT * FROM source
     
    purdue512, Jul 26, 2007 IP
  6. rps111

    rps111 Peon

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    INSERT INTO destination SELECT * FROM source
    works :)
     
    rps111, Jul 30, 2007 IP