Greenplum管理表空间Tablespace(三)

2014-11-24 15:23:28 · 作者: · 浏览: 2
1
(9 rows)
在指定表空间上创建对象:
gtlions=# create table t2(id int) tablespace gtlions_ts1;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gtlions=# select * from pg_tables where tableowner='gtlions';
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers
------------+-----------+------------+-------------+------------+----------+-------------
gtlions | t1 | gtlions | | f | f | f
gtlions | t2 | gtlions | gtlions_ts1 | f | f | f
(2 rows)
我们也可以在会话级别设置默认表空间:
gtlions=# set default_tablespace=gtlions_ts1;
SET
也可以直接在数据库级别修改要使用的默认表空间:
gtlions=# alter database gtlions set default_tablespace=gtlions_ts1;
ALTER DATABASE
-EOF-