点击上方蓝色文字

进行关注
崔鹏,曾获得中国PostgreSQL数据库管理高级工程师(PGCM),是PostgreSQL官方认证讲师,Mysql 5.7/8.0 OCP, Oracle 11g OCM。
创建表空间:
表空间1
postgres@pgexp1-> mkdir opt/tbs_test1
复制
表空间2
postgres@pgexp1-> mkdir opt/tbs_test2
postgres@pgexp1-> psql
psql (12.4)
Type "help" for help.
postgres=# create tablespace tbs_test1 location '/opt/tbs_test1';
CREATE TABLESPACE
postgres=# create tablespace tbs_test2 location '/opt/tbs_test2';
CREATE TABLESPACE
postgres=# \db
List of tablespaces
Name | Owner | Location
------------+----------+----------------
pg_default | postgres |
pg_global | postgres |
tbs_test1 | postgres | /opt/tbs_test1
tbs_test2 | postgres | /opt/tbs_test2
(4 rows)
复制
复制
创建表:复制
postgres=# create table test (id int) tablespace tbs_test1;
CREATE TABLE
postgres=# \d+ test
Table "public.test"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
id | integer | | | | plain | |
Tablespace: "tbs_test1"
Access method: heap
复制
复制
修改表空间复制
postgres=# alter table test set tablespace tbs_test2;
ALTER TABLE
postgres=# \d+ test
Table "public.test"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
id | integer | | | | plain | |
Tablespace: "tbs_test2"
Access method: heap
复制

点击阅读原文 了解更多详情
复制
文章转载自云贝学院,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
外国CTO也感兴趣的开源数据库项目——openHalo
小满未满、
1718次阅读
2025-04-21 16:58:09
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
373次阅读
2025-04-15 14:48:05
中国PostgreSQL培训认证体系新增PGAI应用工程师方向
开源软件联盟PostgreSQL分会
185次阅读
2025-05-06 10:21:13
转发有奖 | PostgreSQL 16 PGCM高级认证课程直播班招生中!
墨天轮小教习
185次阅读
2025-04-14 15:58:34
PG生态赢得资本市场青睐:Databricks收购Neon,Supabase融资两亿美元,微软财报点名PG
老冯云数
146次阅读
2025-05-07 10:06:22
SQL 优化之 OR 子句改写
xiongcc
136次阅读
2025-04-21 00:08:06
告别老旧mysql_fdw,升级正当时
NickYoung
122次阅读
2025-04-29 11:15:18
华象新闻 | PostgreSQL 18 Beta 1、17.5、16.9、15.13、14.18、13.21 发布
严少安
109次阅读
2025-05-09 11:34:10
PostgreSQL中文社区亮相于第八届数字中国峰会
PostgreSQL中文社区
106次阅读
2025-05-07 10:06:20
PostgreSQL的dblink扩展模块使用方法
szrsu
104次阅读
2025-04-24 17:39:30