点击上方蓝色文字

进行关注
崔鹏,曾获得中国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_test2postgres@pgexp1-> psqlpsql (12.4)Type "help" for help.postgres=# create tablespace tbs_test1 location '/opt/tbs_test1';CREATE TABLESPACEpostgres=# create tablespace tbs_test2 location '/opt/tbs_test2';CREATE TABLESPACEpostgres=# \dbList of tablespacesName | Owner | Location------------+----------+----------------pg_default | postgres |pg_global | postgres |tbs_test1 | postgres | /opt/tbs_test1tbs_test2 | postgres | /opt/tbs_test2(4 rows)
创建表:
postgres=# create table test (id int) tablespace tbs_test1;CREATE TABLEpostgres=# \d+ testTable "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 TABLEpostgres=# \d+ testTable "public.test"Column | Type | Collation | Nullable | Default | Storage | Stats target | Description--------+---------+-----------+----------+---------+---------+--------------+-------------id | integer | | | | plain | |Tablespace: "tbs_test2"Access method: heap

点击阅读原文 了解更多详情
文章转载自云贝学院,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




