8.2 Postgres Administration - Move and Drop Tablespaces

Опубликовано: 17 Май 2026
на канале: SQL Depository
328
6

Move and Drop Tablespaces

Postgres Administration - Tablespace

#check existing tablespace
select * from pg_tablespace;

#create tablespace
create tablespace rpt location '/opt/rpt';

#create table in non default tablespace
create table reporting (id int) tablespace rpt;

#check tablespace of a table
select * from pg_tables where tablename='tablename';

#move table to different tablespace
alter table actor set tablespace rpt;

#check table filepath
select * from pg_relation_filepath('actor');