greenplum互動分割槽用於資料增量和資料壓縮變更
阿新 • • 發佈:2019-02-12
-1.建立分割槽轉換臨時表
CREATE TABLE my_schema.for_exchange
with (APPENDONLY=true, COMPRESSLEVEL=9)
as (select * from my_schema.current_partition)
DISTRIBUTED BY (day_id, fst_agc_offc_cd, carr_cd, flt_nbr);
--3.比較資料內容
select 'org',count(*) from my_schema.current_partition group by 1
union
select 'new',count(*) from my_schema.for_exchange group by 1
===============================================================
"new";35375423
"org";35375423
===========================================================
--4.交換分割槽
alter table my_schema.schl_pnrd_daily exchange partition month201303 with table my_schema.for_exchange
--5.檢驗交換無問題
select 'org',count(*) from my_schema.current_partition group by 1
union
select 'new',count(*) from my_schema.for_exchange group by 1
"new";35375423
"org";35375423
-- 6.刪除交換出去的分割槽
drop table my_schema.for_exchange