Can I have multiple data directories?

September 6, 2017 1.3k views
PostgreSQL Ubuntu Ubuntu 16.04

I have two databases on postgreSQL. I am running out of disk space and want to move one of my databases to a different directory. How can I do this?

1 Answer

Hello,

I believe that you can only have one data directory per PostgreSQL cluster. This answer here explains this quite well:

There can be only one data directory for each PostgreSQL cluster. A cluster is a postmaster listening on a port, managing several databases from a single data directory. You can have multiple clusters by starting multiple postmasters with pg_ctl or via a system service, each listening on a different port and using a different data dir.

If you have multiple clusters on a machine you have multiple data directories. It’s unusual to need to do this, but it is possible.

Source

Regards,
Bobby

Have another answer? Share your knowledge.