hydra icon indicating copy to clipboard operation
hydra copied to clipboard

support moving tables between tablespaces

Open kreopt opened this issue 2 years ago • 1 comments

What's wrong?

H! We have two separate tablespaces: default(ssd with relatively small capacity for current data) and hdd (high capacity, historical data) and don't want to store columnar tables on ssd. But there is an error on moving columnar table:

alter table fact_events_1_2021 set tablespace hdd;
ОШИБКА:  columnar_relation_copy_data not implemented

Is there a way to move this data or some plans to implement this feature?

kreopt avatar Oct 18 '23 04:10 kreopt

Thanks for the report. I believe tablespaces themselves should work but moving tables isn't supported yet.

The best I can suggest is to copy the table like so:

-- copy table to a new table
create table fact_events_1_2021_hdd (like fact_events_1_2021) using columnar tablespace hdd;
insert into fact_events_1_2021_copy select * from fact_events_1_2021;
-- swap the two table names
alter table fact_events_1_2021 rename to fact_events_1_2021_ssd;
alter table fact_events_1_2021_hdd rename to fact_events_1_2021;
-- when you are ready, drop the old table on the ssd.
drop table fact_events_1_2021_ssd;

wuputah avatar Oct 18 '23 14:10 wuputah