Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 469
Viraj Avatar asked Mar 27 '26 14:03

Viraj


1 Answers

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.

like image 78
stefan.schwetschke Avatar answered Apr 01 '26 15:04

stefan.schwetschke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!