postgresql_16:7.1.85.4 Examples
PostgreSQL 16 > Reference > SQL Commands > CREATE TABLESPACE > Examples
To create a tablespace dbspace at file system location /data/dbs, first create the directory using operating system facilities and set the correct ownership: mkdir /data/dbs chown postgres:postgres /data/dbs Then issue the tablespace creation command inside PostgreSQL: CREATE TABLESPACE dbspace LOCATION '/data/dbs';
To create a tablespace owned by a different database user, use a command like this: CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';