Created
January 8, 2016 02:15
-
-
Save fabriziomello/c3cfcee97e9c2945aa5e to your computer and use it in GitHub Desktop.
ALTER TABLE ... SET LOGGED, SET TABLESPACE ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fabrizio=# \db+ | |
| List of tablespaces | |
| Name | Owner | Location | Access privileges | Options | Size | Description | |
| ------------+----------+----------+-------------------+---------+--------+------------- | |
| pg_default | fabrizio | | | | 27 MB | | |
| pg_global | fabrizio | | | | 496 kB | | |
| (2 rows) | |
| fabrizio=# create tablespace tb1 location '/tmp/tablespace'; | |
| CREATE TABLESPACE | |
| fabrizio=# | |
| fabrizio=# \db+ | |
| List of tablespaces | |
| Name | Owner | Location | Access privileges | Options | Size | Description | |
| ------------+----------+-----------------+-------------------+---------+---------+------------- | |
| pg_default | fabrizio | | | | 27 MB | | |
| pg_global | fabrizio | | | | 496 kB | | |
| tb1 | fabrizio | /tmp/tablespace | | | 0 bytes | | |
| (3 rows) | |
| fabrizio=# create unlogged table foo(id serial); | |
| CREATE TABLE | |
| fabrizio=# insert into foo select * from generate_series(1,100); | |
| INSERT 0 100 | |
| fabrizio=# \db+ | |
| List of tablespaces | |
| Name | Owner | Location | Access privileges | Options | Size | Description | |
| ------------+----------+-----------------+-------------------+---------+---------+------------- | |
| pg_default | fabrizio | | | | 27 MB | | |
| pg_global | fabrizio | | | | 496 kB | | |
| tb1 | fabrizio | /tmp/tablespace | | | 0 bytes | | |
| (3 rows) | |
| fabrizio=# alter table foo set logged, set tablespace tb1; | |
| ALTER TABLE | |
| fabrizio=# \db+ | |
| List of tablespaces | |
| Name | Owner | Location | Access privileges | Options | Size | Description | |
| ------------+----------+-----------------+-------------------+---------+--------+------------- | |
| pg_default | fabrizio | | | | 27 MB | | |
| pg_global | fabrizio | | | | 496 kB | | |
| tb1 | fabrizio | /tmp/tablespace | | | 12 kB | | |
| (3 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment