Ali Hussain
Ali Hussain

Reputation: 896

Can we change data directory for single table or database in postgresql

Can we change data directory for single table or database in postgresql. Actually my requirement is that I want to keep all tables data in C drive but customers table data in D drive. how to achieve this?

Upvotes: 1

Views: 228

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246268

You should create a tablespace for the tables outside the data directory.

For example:

CREATE TABLESPACE tbsp LOCATION 'D:\customer_tables';

Then add TABLESPACE tbsp to all CREATE TABLE statements that should be on D.

Upvotes: 1

Related Questions