Ad Widget

Collapse

Timescaledb upgrade. Why not import directly form old table but use temp table ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • snsakala
    Junior Member
    • Feb 2022
    • 6

    #1

    Timescaledb upgrade. Why not import directly form old table but use temp table ?

    On the documentation there is an example for upgrading timescaledb for primary key



    Is it realy necessary to export then reimport on a temporary table ?

    Code:
    \copy temp_history_uint FROM '/tmp/history_uint.csv' DELIMITER ',' CSV
    -- Create hypertable and populate it select create_hypertable('history_uint', 'clock', chunk_time_interval => 86400, migrate_data => true);
    INSERT INTO history_uint SELECT * FROM temp_history_uint ON CONFLICT (itemid,clock,ns) DO NOTHING;
    why not directly import data from the old table

    Code:
    INSERT INTO history_uint SELECT * FROM history_uint_old ON CONFLICT (itemid,clock,ns) DO NOTHING;
    Can someone explain ?

    Thanks

    -Stephane
  • maand
    Junior Member
    • Mar 2019
    • 15

    #2
    Did you get any answer on this, or did you do test to insert directly from the old table?

    //Mathias

    Comment

    • snsakala
      Junior Member
      • Feb 2022
      • 6

      #3
      No answer, i tested the insert from old table. i did not get any error but not sure if data is good

      Comment

      • lasseoe
        Junior Member
        • Aug 2008
        • 15

        #4
        Originally posted by snsakala
        On the documentation there is an example for upgrading timescaledb for primary key



        Is it realy necessary to export then reimport on a temporary table ?

        Code:
        \copy temp_history_uint FROM '/tmp/history_uint.csv' DELIMITER ',' CSV
        -- Create hypertable and populate it select create_hypertable('history_uint', 'clock', chunk_time_interval => 86400, migrate_data => true);
        INSERT INTO history_uint SELECT * FROM temp_history_uint ON CONFLICT (itemid,clock,ns) DO NOTHING;
        why not directly import data from the old table

        Code:
        INSERT INTO history_uint SELECT * FROM history_uint_old ON CONFLICT (itemid,clock,ns) DO NOTHING;
        Can someone explain ?

        Thanks

        -Stephane
        I'm interested in this as well - our DB is rather large so anything that minimize downtime is most welcome.

        Comment

        Working...