snippetsqlMinor
Create database on new partition
Viewed 0 times
databasepartitionnewcreate
Problem
I use postgresql 9.1, on ubuntu 12.04. I had installed the depot package.
I have added a new partition to my system, and I would like to create a postgresql database on this partition ( which will be entirely dedicated to this database).
My pgdata is located in
Is there a way to create a database specifically on a specified partition ? Something more "canonical" (not a play of word with ubuntu)
I have added a new partition to my system, and I would like to create a postgresql database on this partition ( which will be entirely dedicated to this database).
My pgdata is located in
var/lib/postgresql/9.1/main. I plan to stop the postgresql service, copy the pgdata content to the new partition, then make a symbolic link to the new partition, chown the new directory to postgres user, restart postgresql... but I'm afraid this all looks more like a hack. Is there a way to create a database specifically on a specified partition ? Something more "canonical" (not a play of word with ubuntu)
Solution
CREATE TABLESPACE could be used.
and now the tablespace can be used as parameter when creating a database, (or a table, or an index)
create tablespace dedicated_datastore owner postgres location '/my/mount/point/'and now the tablespace can be used as parameter when creating a database, (or a table, or an index)
create database my_database tablespace dedicated_datastoreCode Snippets
create tablespace dedicated_datastore owner postgres location '/my/mount/point/'create database my_database tablespace dedicated_datastoreContext
StackExchange Database Administrators Q#37013, answer score: 8
Revisions (0)
No revisions yet.