Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Mon, 12 Sep 2016 @ 13:58:55 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Skewed Delete Query
 
From:   Bourgoin, Greg

Perhaps a bit late to the party, been on vacation, however ... I wouldn't do a delete and incur the transaction hit. Use empty tables instead to keep the data you want instead of trying to get rid of the data you don't want.

It's a multistep process but will run in a few seconds.

-- Create a new table for the data you want to keep.

     CREATE TABLE DB1.TAB1_stg_new AS DB1.TAB1_stg WITH NO DATA AND STATISTICS;

-- Insert the data you want to keep from the old table to the new table.

     INSERT INTO DB1.TAB1_stg_new
     SELECT A.*

....using whatever join/filter logic you need...

-- Confirm the new table has what you need and then:

     RENAME DB1.TAB1_stg TO DB1.TAB1_stg_old;
     RENAME DB1.TAB1_stg_new TO DB1.TAB1_stg;
     COLLECT STATISTICS ON DB1.TAB1_stg;


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 24 Jul 2020