Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDQs1-0004U6-Sm for pgsql-docs@arkaria.postgresql.org; Wed, 12 Feb 2014 03:52:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDQs1-0005AR-Ca for pgsql-docs@arkaria.postgresql.org; Wed, 12 Feb 2014 03:52:21 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDQrz-0005AI-Dq for pgsql-docs@postgresql.org; Wed, 12 Feb 2014 03:52:19 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDQrw-0003gV-CS for pgsql-docs@postgresql.org; Wed, 12 Feb 2014 03:52:18 +0000 Received: from ayaki.localdomain (106-68-42-154.dyn.iinet.net.au [106.68.42.154]) by mrelayeu.kundenserver.de (node=mreue102) with ESMTP (Nemesis) id 0LtFKF-1VB6lJ0NIp-012nRM; Wed, 12 Feb 2014 04:52:15 +0100 Message-ID: <52FAEFEA.4060609@2ndquadrant.com> Date: Wed, 12 Feb 2014 11:52:10 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: PostgreSQL Developers Subject: PATCH: Warn users about tablespace abuse data loss risk X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------010906010109020805010102" X-Provags-ID: V02:K0:m6HcXYynoawHdpSvmIY7twem/8O8qZirUMxbvA4PyjM LFg7KMfuMxZ1YQnh8O2dpZ/FfYDJzkOaLZ4aVRML5AI8+rVeJ8 8SBNiTeOBfd9NSr2zD7SkFUsx791UDEdtg6ed8GxvoTVoOqQEl O7yrQds81azyJVcI/FxknNwvnZ7u6WwraIxsDMr2TNHOAuY+QG ttbaKbEo55IM9uCxMwu2CXDEY+/mSUqX2886sFYhvBtrSRAKLC 2q2A4y7eFWZ2Uc6A1hqSCjBBNnHxetTr69gg+vEOicYX87foLB I4dZdJV2LPqdBTaNw1FlBymFEc8JdX7LZRWMIHTaolKEaD7BFO ONN0GfpSx+HiFBgldkuEmyphohEp8/OlSLM3oX8VU X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org This is a multi-part message in MIME format. --------------010906010109020805010102 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all I've just seen another case of data loss due to misuse of / misunderstanding of tablespaces: http://dba.stackexchange.com/questions/58704/how-do-i-access-a-old-saved-tablespace-after-reinstalling-postgres and it's prompted me to write some docs amendments to make it more obvious that *you shouldn't do that*. Not that it'll stop people, but it'll at least mean they can't say we didn't warn them. This is actually quite important, because many users are used to MySQL's MyISAM, where each table contains its own metadata and is readable by simply copying the table into a different MySQL install's data directory. It doesn't even have to be the same version! Users are clearly surprised that PostgreSQL tablespaces don't have the same properties. Thoughts? -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------010906010109020805010102 Content-Type: text/x-patch; name="0001-Warn-about-risks-of-tablespace-misuse.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Warn-about-risks-of-tablespace-misuse.patch" From 6d0abd7bcaca596ac2298d8f7ac408e465ec1aef Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Wed, 12 Feb 2014 11:48:23 +0800 Subject: [PATCH] Warn about risks of tablespace misuse --- doc/src/sgml/manage-ag.sgml | 17 +++++++++++++++++ doc/src/sgml/ref/create_tablespace.sgml | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/doc/src/sgml/manage-ag.sgml b/doc/src/sgml/manage-ag.sgml index b44d521..dd43e19 100644 --- a/doc/src/sgml/manage-ag.sgml +++ b/doc/src/sgml/manage-ag.sgml @@ -379,6 +379,23 @@ dropdb dbname expensive, slower disk system. + + + Tablespaces are not suitable for backup/redundancy. + If the main database cluster is lost, tablespaces cannot simply be reattached + to a different database cluster, the metadata from the original is required + to read the tablespace. Similarly, if you lose a tablespace (deletion, + disk failure, etc) the main database may become unreadable or fail to start. + + + + Do not attempt to use tablespaces to transfer tables between database + clusters, for backup and restore, or to partition your data based on + the reliability of the storage it is on. Never put a tablespace + on a ramdisk or temporary file system. + + + To define a tablespace, use the diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml index 04c5fb8..83edd88 100644 --- a/doc/src/sgml/ref/create_tablespace.sgml +++ b/doc/src/sgml/ref/create_tablespace.sgml @@ -50,6 +50,16 @@ CREATE TABLESPACE tablespace_name CREATE INDEX or ADD CONSTRAINT to have the data files for these objects stored within the specified tablespace. + + + + You can't use the contents of a tablespace without the database it's part of, + nor can you use the main database if a tablespace is missing. Don't try to + use tablespaces for backup or redundancy. + See . + + + -- 1.8.3.1 --------------010906010109020805010102 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --------------010906010109020805010102--