PostgreSQL Tablespace Management
PostgreSQL Tablespace Management
A tablespace is a disk location where PostgreSQL stores data files containing database
objects such as indexes and tables.
method 2):
Reset the changes:
To moves the data file(s) associated with the database, table, index to the new
tablespace:
CREATE DATABASE db_name;
ALTER DATABASE db_name SET TABLESPACE tablespace_name;
CREATE TABLE table_name(col1 data_type,….);
ALTER TABLE table_name SET TABLESPACE tablespace_name;
PostgreSQL does not allow altering the tablespace of a primary key constraint. Instead,
you need to move the index associated with the primary key constraint to the new
tablespace.
CREATE TABLE table_name(column_name data_type PRIMARY KEY);