Tablespace

PostgreSQL · Wikibooks

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From Wikibooks, under CC BY-SA 4.0, as the source states it. This page at Wikibooks.

    Tablespace

    The default behaviour of PostgreSQL is, that all data, indices, and management information is stored in subdirectories of a single directory. But this approach is not always suitable. In some situation you may want to change the storage area of one or more tables: data grows and may blow up partition limits, you may want to use fast devices like a ssd for heavily used tables, etc. . Therefore you need a technique to become more flexible.

    Tablespaces offers the possibility to push data on arbitrary directories within your file system.

    CREATE TABLESPACE fast LOCATION '/ssd1/postgresql/fastTablespace';
    

    After the tablespace is defined it can be used in DDL statements.

    CREATE TABLE t1(col_1 int) TABLESPACE fast;