teblespaceの作成とテーブル割当

転ばぬ先のなんとやら。

先ずは、tablespaceの保存先ディレクトリを作成

$ mkdir -p /var/lib/pgsql/9.1/tablespace/hoge

postgresのスーパーユーザで

# create TABLESPACE hoge_ts LOCATION '/var/lib/pgsql/9.1/tablespace/hoge';
CREATE TABLESPACE

# \db+
                              テーブルスペース一覧
    名前    |  所有者  |                場所                | アクセス権 | 説明 
------------+----------+------------------------------------+------------+------
 hoge_ts    | postgres | /var/lib/pgsql/9.1/tablespace/hoge |            | 
 pg_default | postgres |                                    |            | 
 pg_global  | postgres |                                    |            | 

として作成、テーブルにtablespaceをセットする。

# ALTER TABLE hoge set TABLESPACE hoge_ts;