DBAtlas · Database operations atlas

Add a new tablespace

PostgreSQLStorage

Command

CREATE TABLESPACE ssd_ts OWNER postgres LOCATION '/mnt/ssd/pgdata';

What it does

Defines a new tablespace in the given directory; tables and indexes can be placed on that disk.

When to use it

To spread data onto a different disk (e.g., fast SSD) and separate I/O.

Caution

The directory must already exist, be empty and be owned by the postgres user. Do not spread data to other disks with symbolic links; use PostgreSQL's own tablespace mechanism.

Open in DBAtlas →

Related