Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBgA0-0007Z0-RB for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 13:42:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBg9y-0003pq-FN for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 13:42:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBg9y-0003pj-5n for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 13:42:34 +0000 Received: from mta1.recol.net ([64.207.103.6]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBg9v-0001Kb-0H for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 13:42:33 +0000 Received: from wrkhors.com (unknown [75.37.52.9]) by mta1.recol.net (Postfix) with ESMTPSA id 927C1398A71; Wed, 3 Apr 2019 09:42:28 -0400 (EDT) Date: Wed, 3 Apr 2019 08:39:33 -0500 From: Steven Lembark To: pgsql-general@lists.postgresql.org Cc: lembark@wrkhors.com Subject: Re: Move vs. copy table between databases that share a tablespace? Message-ID: <20190403083933.515a990b.lembark@wrkhors.com> In-Reply-To: <6350b533-4410-358f-f9f5-99be7abdaf0b@gmail.com> References: <20190403081825.14dc71c9.lembark@wrkhors.com> <6350b533-4410-358f-f9f5-99be7abdaf0b@gmail.com> Organization: Workhorse Computing X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Workhorse: Quite MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 3 Apr 2019 08:33:54 -0500 Ron wrote: > On 4/3/19 8:18 AM, Steven Lembark wrote: > > Trying to find a way of moving a large table between databases > > in the same cluster. There is not sufficient space to copy the > > contents -- the dedicated tablespace that fits the beastie is > > on an 80% full disk. > > > > Given that the two databases live in the same cluster and have > > the owner & the tablespace in common, is there any way to move > > the contents without a dump & reload? > > COPY TO STDIN and pipe that through ssh to another server? That makes a copy. There is no place to store two copies of the full data on disk. I'm basically trying to perform the moral equivalent of what "mv" does in the filesystem: re-link the inode and remove the old inode without duplicating the data. Since the tablespace is visible to both I would get that there is some way to alter table... that allocates the space on disk to the new database w/o having to unload all 400M rows -- if it comes down to that I'll have to copy it into xz and load it back in the new database. -- Steven Lembark 3920 10th Ave South Workhorse Computing Birmingham, AL 35222 lembark@wrkhors.com +1 888 359 3508