DBAtlas · Database operations atlas

Move a table to another tablespace

PostgreSQLStorage

Command

ALTER TABLE customer SET TABLESPACE ssd_ts;

What it does

Physically moves all of the table's data to the new tablespace (disk).

When to use it

To move a table to a faster/separate disk.

Caution

An ACCESS EXCLUSIVE lock is taken on the table during the move; the table is inaccessible until the move completes. Do it in a maintenance window for large tables.

Open in DBAtlas →

Related