简体   繁体   中英

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM