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 1hBgcY-0000Zg-Q8 for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 14:12:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBgcX-0002hH-KS for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 14:12:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBgcX-0002hA-5f for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 14:12:05 +0000 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBgcU-0002WX-V2 for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 14:12:04 +0000 Received: by mail-ot1-x343.google.com with SMTP id d24so15465913otl.11 for ; Wed, 03 Apr 2019 07:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=jVpYA2Tw/QPp42SsAREsIGthXG1TTH2AumbH96rKWZQ=; b=qGv+t+FbWtRWABT5KlqtYT2vjxtp5JCImgfMoV7VGK8j30JXl/nlJ7sweubAVpQIy2 ItNn48wd5DVV/p0TmNw+pK0wQSXySo4bpiNZNWRbpNnDtueEjTt3+UVYmBbw8KvoE1ao RMWI3oiO8x3VaKMUni/BoRh5DnGBQX+oNw8KzgWDsnI6cf+nmo5FMvItnIJIoyy48fc4 fxtHLvhHwYzCAbHQ9IM7zdM9h0ZqLFgoKakSEVg4PEZ4xhY+cPywqIUenHwF1kQvTR5N yMZU7clXCn+NGuMApHpOlgIr02KhZ96na32CXnuvBTw+5jxZwEnWqq9v2ZrinmrUlebY XSdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jVpYA2Tw/QPp42SsAREsIGthXG1TTH2AumbH96rKWZQ=; b=HoT6LQLiySc4nmD+RqfJ1EKUkqpVB9+1nzRDIJLAYI6wi0piUx4MT18lQtxc5zItav +WnxlzriOzrsT9KLnH2Rb1ZelLBv8/MJwt26pGSukC6iBAIVFRidYsbH2u+DcVAjAt90 UKiWgkKiy6EIr9rz6YUqBsDPtgX1cb2wurU5wsdFPru2nVZbnjEu4iBgByecf6Mfsud1 NP/LHjS6+Y11JeXlWPBUJ0g2IGbds1Xer4wSxLtQnLwh+bLiaWJfMWEEvh6XhB7m7AfS R+FuDsrsWblKzzwnOi0MqklY9NZ0R4o1xkl/AQcWdA+0TrUFwSQAQkeuND9waMRp3LgS OGIw== X-Gm-Message-State: APjAAAVjGpl5E0XWW8oYck2opGJ3F9oSnjdZOc51OHHU3P1Dnmj8puix NczwgVb3tZ3R5VLNBSXpSAC0FGPdJds= X-Google-Smtp-Source: APXvYqwoKlyj0nOLRoKFmw9jf3nNjMH+CV1AEf3N72/bx+sld4RqGJL1jKnM2Jom7f+J4mOAzNJoYw== X-Received: by 2002:a9d:3b44:: with SMTP id z62mr57787685otb.319.1554300721814; Wed, 03 Apr 2019 07:12:01 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id 66sm8235845otc.25.2019.04.03.07.12.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 07:12:01 -0700 (PDT) Subject: Re: Move vs. copy table between databases that share a tablespace? To: pgsql-general@lists.postgresql.org References: <20190403081825.14dc71c9.lembark@wrkhors.com> <6350b533-4410-358f-f9f5-99be7abdaf0b@gmail.com> <20190403083933.515a990b.lembark@wrkhors.com> From: Ron Message-ID: <1e17699e-de0a-6a5f-9bed-64de27335099@gmail.com> Date: Wed, 3 Apr 2019 09:12:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190403083933.515a990b.lembark@wrkhors.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/3/19 8:39 AM, Steven Lembark wrote: > 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. Through a pipe to a different server. > 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. > -- Angular momentum makes the world go 'round.