All Products
Search
Document Center

PolarDB:DROP TABLESPACE

Last Updated:Mar 28, 2026

Removes a tablespace from the system.

Prerequisites

Before dropping a tablespace, confirm that:

  • You are the tablespace owner or a superuser.

  • The tablespace contains no database objects — including objects from other databases that may still reside in it.

  • No active session lists the tablespace in its temp_tablespaces setting. Temporary files in the tablespace might cause the drop to fail.

Syntax

DROP TABLESPACE [ IF EXISTS ] name

Parameters

ParameterDescription
IF EXISTSDoes not throw an error if the tablespace does not exist. A notice is issued instead.
nameThe name of the tablespace to drop.

Usage notes

DROP TABLESPACE cannot run inside a transaction block.

Examples

Drop a tablespace:

DROP TABLESPACE mystuff;

Drop a tablespace only if it exists:

DROP TABLESPACE IF EXISTS mystuff;

See also