Attaching/detaching tablespaces (or, in general, parts of a DB)

Started by Yang Zhangabout 15 years ago4 messagesgeneral
Jump to latest
#1Yang Zhang
yanghatespam@gmail.com

Is it possible to attach or detach parts of a DB (e.g. tablespaces),
such that I can flexibly move the disks containing the DB tables
around to different hosts?

The last discussion I could find on this topic is from 2007, and the
answer was "No":

http://postgresql.1045698.n5.nabble.com/Possible-to-Attach-Detach-Tablespaces-td1885602.html

Wondering if there's been any change to the answer since then. I can
alternatively dump/load, which is slower and requires 2x the disk
space. Thanks in advance.

#2John R Pierce
pierce@hogranch.com
In reply to: Yang Zhang (#1)
Re: Attaching/detaching tablespaces (or, in general, parts of a DB)

On 04/06/11 7:05 PM, Yang Zhang wrote:

Is it possible to attach or detach parts of a DB (e.g. tablespaces),
such that I can flexibly move the disks containing the DB tables
around to different hosts?

The last discussion I could find on this topic is from 2007, and the
answer was "No":

http://postgresql.1045698.n5.nabble.com/Possible-to-Attach-Detach-Tablespaces-td1885602.html

Wondering if there's been any change to the answer since then. I can
alternatively dump/load, which is slower and requires 2x the disk
space. Thanks in advance.

pg_dump -Fc somedatabase | pg_restore -h newhost newdb

voila, no temp space used.

#3Guillaume Lelarge
guillaume@lelarge.info
In reply to: Yang Zhang (#1)
Re: Attaching/detaching tablespaces (or, in general, parts of a DB)

Le 07/04/2011 04:05, Yang Zhang a �crit :

Is it possible to attach or detach parts of a DB (e.g. tablespaces),
such that I can flexibly move the disks containing the DB tables
around to different hosts?

No, you can't. But you actually don't need to. Users won't be able to
access the objects you're moving, so no issues.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

#4Vibhor Kumar
vibhor.kumar@enterprisedb.com
In reply to: Yang Zhang (#1)
Re: Attaching/detaching tablespaces (or, in general, parts of a DB)

On Apr 7, 2011, at 7:35 AM, Yang Zhang wrote:

Is it possible to attach or detach parts of a DB (e.g. tablespaces),
such that I can flexibly move the disks containing the DB tables
around to different hosts?

The last discussion I could find on this topic is from 2007, and the
answer was "No":

http://postgresql.1045698.n5.nabble.com/Possible-to-Attach-Detach-Tablespaces-td1885602.html

Wondering if there's been any change to the answer since then. I can
alternatively dump/load, which is slower and requires 2x the disk
space. Thanks in advance.

No. You can't do that.

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com