A tablespace is a location on disk where PostgreSQL stores data files containing database objects e.g., indexes., and tables. PostgreSQL uses a tablespace to map a logical name to a physical location on disk.
CREATE TABLESPACE demo LOCATION 'c:/data/demo';
create a new database named dbdemoand set its tablespace to demo:
CREATE DATABASE dbdemo TABLESPACE = demo;
create a new table named testin the dbdemoand set it tablespaceto demo:
CREATE TABLE test (
ID serial PRIMARY KEY,
title VARCHAR (255) NOT NULL
) TABLESPACE demo;
ALTER DATABASE dbdemo
SET TABLESPACE = pg_default;
DROP TABLESPACE demo;
No comments:
Post a Comment