ALTER TABLESPACE

Change the definition of the tablespace.

Summary

ALTER TABLESPACE name RENAME TO new_name

ALTER TABLESPACE name OWNER TO new_owner

ALTER TABLESPACE name SET ( tablespace_option = value [, ... ] )

ALTER TABLESPACE name RESET ( tablespace_option [, ... ] )

describe

ALTER TABLESPACE Changes the definition of the tablespace.

You must have a tablespace to use ALTER TABLESPACE. To change the owner, you must also be a direct or indirect member of the newly owned role. (Note that superusers will automatically have these privileges.)

Parameters

name

  • The name of an existing tablespace.

new_name

  • The name of the new tablespace. New tablespace names cannot start with pg or gp. (This type of name is reserved for system tablespace).

new_owner

  • New owner of this tablespace.

tablespace_parameter

  • Tablespace parameters to set or reset. Currently, the only available parameters are seq_page_cost and random_page_cost. Setting these two values ​​for a particular tablespace will override the planner's usual estimate of the overhead of reading pages from tables in that tablespace, determined by configuration parameters of the same name (see seq-page-cost, random-page-cost). This can be useful if a tablespace is on a disk that is faster or slower than the rest of the I/O subsystem.

Example

Rename the tablespace index_space to fast_raid:

ALTER TABLESPACE index_space RENAME TO fast_raid;

Change the owner of the tablespace index_space:

ALTER TABLESPACE index_space OWNER TO mary;

compatibility

There is no ALTER TABLESPACE statement in the SQL standard.

See also

CREATE TABLESPACE , DROP TABLESPACE