DROP TABLESPACE

Synopsis

Use the DROP TABLESPACE statement to remove a tablespace from the cluster.

Syntax

drop_tablespace ::= DROP TABLESPACE [ IF EXISTS ] tablespace_name

drop_tablespace

DROPTABLESPACEIFEXISTStablespace_name

Semantics

  • Only the owner or a superuser can drop a tablespace.
  • Before dropping it, ensure that the tablespace is devoid of all database objects.
  • Be aware that even if the current database isn't using the tablespace, objects from other databases might still occupy it.
  • Additionally, the DROP operation may encounter issues if the tablespace is specified in the temp_tablespaces setting of any active session, as there could be temporary files or objects present in the tablespace.

if_exists

Under normal operation, an error is raised if the tablespace does not exist. Adding IF EXISTS will quietly ignore any non-existent tablespaces specified.

tablespace_name

Specify the name of the tablespace to be dropped.

Example

See Tablespaces and Row Level Geo Partitioning for full guides.

See also