Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpdch-0005Pe-3O for pgsql-general@arkaria.postgresql.org; Tue, 14 Aug 2018 18:00:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpdce-0006hg-JG for pgsql-general@arkaria.postgresql.org; Tue, 14 Aug 2018 18:00:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpdcd-0006hZ-Kn for pgsql-general@lists.postgresql.org; Tue, 14 Aug 2018 18:00:48 +0000 Received: from resqmta-ch2-09v.sys.comcast.net ([2001:558:fe21:29:69:252:207:41]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpdcW-00083r-Fv for pgsql-general@lists.postgresql.org; Tue, 14 Aug 2018 18:00:46 +0000 Received: from resomta-ch2-13v.sys.comcast.net ([69.252.207.109]) by resqmta-ch2-09v.sys.comcast.net with ESMTP id pXYHfbOcR5zkYpdcUf4zu4; Tue, 14 Aug 2018 18:00:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1534269638; bh=ClAZL9PRFV7MEGaTPOWFNFYsZ0mb/ZrJw6zP35qVMQk=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=gU2oLZHqq2qcPetDV7gebaylLjFRYKWEqaEEC6+hkowfviiWdTHoORFmU+xnNtLbz AZf0DicxJP3IWe8j4QZOzU6ACMpXGLolNFxdlsufXAjspgcoiZaARRAnLZx+c0xrEl IIZeWW/yjXy4k/I6GQ3MMDRgBoWnM4Rb+rhgPsrBeY8Ii1FWOxOOpO/xxd4vZZ/8mV +yAa2PFLB1CsEJ7+dF9iLH0gUpe0W63v04v9bycxTW8kqdkc+YYhNI5bCFfDJpAFj8 MxFhMs/uonjHFsbVDLneTVrNvae4Ama9JSvyjwM9TKVE/fu4H2IE0drEM3rABCqkvO 6uw+oftXrSn6w== Received: from jsievers.comcast.net ([12.187.116.132]) by resomta-ch2-13v.sys.comcast.net with ESMTPA id pdcKffCLJL5P9pdcKf89w3; Tue, 14 Aug 2018 18:00:36 +0000 Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id E0C43260056; Tue, 14 Aug 2018 13:00:27 -0500 (CDT) From: Jerry Sievers To: Tom Lane Cc: Jack Cushman , pgsql-general@lists.postgresql.org Subject: Re: Duplicating data folder without tablespace, for read access References: <2290.1534263832@sss.pgh.pa.us> Date: Tue, 14 Aug 2018 13:00:27 -0500 In-Reply-To: <2290.1534263832@sss.pgh.pa.us> (Tom Lane's message of "Tue, 14 Aug 2018 12:23:52 -0400") Message-ID: <87d0ukde10.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-CMAE-Envelope: MS4wfCYfKmEVsLjmcy+7hj/DSKlPKZqaPIFVlxMErflnimOFs7dtM9irsMX9ytsw0oVwOmCk3LNPOOVGUKdXvRA7oPkqAKnRCvz1yQHxqoKlOOK3q+zJBscX C7oltyIVzh4NyzEhoG91rHK5IUFOkISn1gFJP8dDWbpBGQnsmfc61yMOaW8mxQRmc9tUA4yH/qjCOtSEYYo2BFSbYMtpVuwFhpY/b1v4QYqdA3+L3vx5PQgO GEXbHrik++fJqLejQoEoMLE8NzQbCSRBSAzpzZtOLnY= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Lane writes: > Jack Cushman writes: > >> Now here's the situation where I want to do what Christophe said not to do: >> :) > >> I have a large database of text, with a 600GB table and a 100GB table >> connected by a join table. They both see occasional updates throughout the >> week. Once a week I want to "cut a release," meaning I will clone just the >> 100GB table and copy it to a "release" server for read-only web access. > >> My procedure would be: > >> - keep the 600GB table on a separate tablespace >> - cleanly stop postgres on both servers >> - copy the data folder to the release server >> - delete pg_tblspc/* on the release server >> - start postgres on both servers > >> In local testing this seems to work -- the release server works fine, and I >> only get an error message if I try to access the missing tables, which is >> expected. But are there reasons this is going to bite me if I try it in >> production? > > Sooner or later, autovacuum is going to try to touch the missing table. > Maybe you can limp along with autovac failing in the background, > especially if this is a throwaway copy of the DB with little or no > write activity. But I'm not sure how well that will work. > > Probably, the worst-case scenario would be for the database to shut > down because it thinks it's in XID wraparound trouble. But it's hard > to see how you get to that without lots of write traffic, so maybe > you can get away with this. > > regards, tom lane > With Pg being pretty good about letting you drop objects that have missing backend storage bits, such as when we snapshot large DBs on the SAN which does *not* capture our NVMe temp tablespace... I'd say find the objects supposed to be in the missing tablespace by catalog scraping and drop them. You'll see warnings or whatever in the logs that file $foo not found but the objects are then gone nonetheless. Presuming this avoids risk of eventual wrap conditions etc due to cronic autovac failure if tables left in catalogs. FWIW > -- Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net p: 312.241.7800