Search code examples
postgresqlpostgresql-9.3

How to add data file to PostgreSQL database tablespace?


I am using PostgreSQL and I want to add a new data files to existing tablespace ( like in oracle )

I could not found any description on this on PostgreSQL documentation. How to do this ?


Solution

  • PotgreSQL works different than Oracle. It has a much simpler concept for data storage. Data blocks, extents and segments don't exist. In the same spirit, a tablespace is not split into multiple data files. You just create the tablespace and PostgreSQL creates the necessary files to store the data.

    When creating a tablespace, you can provide a location, where PostgreSQL should store the data:

    CREATE TABLESPACE dbspace LOCATION '/data/dbs';
    

    This works similar to bigfile tablespaces in Oracle, where you also don't have to manage data files.