首页 > 数据库技术 > 详细

PostgreSQL表空间

时间:2015-12-07 20:30:58      阅读:263      评论:0      收藏:0      [点我收藏+]

postgres=# \h create tablespace
Command: CREATE TABLESPACE
Description: define a new tablespace
Syntax:
CREATE TABLESPACE tablespace_name
[ OWNER user_name ]
LOCATION ‘directory‘
[ WITH ( tablespace_option = value [, ... ] ) ]

postgres=# create tablespace tbs_data location ‘/opt/pg_tablespace‘;
CREATE TABLESPACE
postgres=# create database db01 tablespace tbs_data;
CREATE DATABASE
postgres=# alter database db01 set tablespace tbs_data ;
ALTER DATABASE

创建表时指定表空间
postgres=# create table test01(id int,note text) tablespace tbs_data ;
CREATE TABLE

创建索引时指定表空间
postgres=# create index idx_test01_id on test01 (id) tablespace tbs_data ;
CREATE INDEX

建唯一索引时指定约束索引的表空间
postgres=# alter table test01 add constraint unique_test01_id unique(id) using index tablespace tbs_data ;
ALTER TABLE
把表从一个表空间移动到另一个 表空间
postgres=# alter table test01 set tablespace pg_default ;
ALTER TABLE

PostgreSQL表空间

原文:http://www.cnblogs.com/songyuejie/p/5026745.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!