I have a PostgreSQL database living on an external hard disk (RAID0 via Thunderbolt). So far I accessed it from a PostgreSQL server running on my MacBook Pro. As my work on this database is getting more and more intensive the queries are getting more and more complex, too. Therefore I'd like to use my brand spanking new iMac from now on.

My question is: Can I somehow tell the new PostgreSQL server (running on the iMac) to use the data that is already living in the tablespace on the external disk? Or will I have to export & import all the data manually (pg_dump, pg_restore)?


I strongly recommend doing a dump and reload.

Don't put tablespaces on removable media, it doubles your chances of data loss. If either the main database on the main disk or the removable media fails / is lost, your data's gone. A tablespace cannot be read without the database it's from.

| improve this answer | |
  • Thank you for your reply. I opted for the dump/restore. I appreciate the comment about the storage of tablespaces on external media, but currently (due to the sheer size of my DB) there's no way around it, I'm afraid... – Sam Wise Aug 16 '13 at 6:10
  • @SamWise Then make very, very sure you have good backups. Take regular pg_dump backups and store them somewhere. Otherwise sooner or later you will lose your data with a setup like you have. – Craig Ringer Aug 16 '13 at 6:41
  • Just wanted to note that tablespace files are inseparable from the database because of things mentioned at postgresql.nabble.com/… - oids, commit logs and probably all sorts of other internal references are relied upon by a tablespace but do not reside in the same files. – Josip Rodin Sep 24 '15 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.