DBAtlas · Database operations atlas

Move an index to another tablespace

PostgreSQLStorage

Command

ALTER INDEX customer_email_idx SET TABLESPACE ssd_ts;

What it does

Moves the index to the given tablespace.

When to use it

To place indexes on a disk separate from the data and spread I/O.

Caution

An ACCESS EXCLUSIVE lock is taken during the move; the index cannot be used. ALTER TABLE ... SET TABLESPACE does not cover the table's indexes, so it cannot move them all at once; move each index separately.

Open in DBAtlas →

Related