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 1h26Ua-0000pI-GA for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 03:48:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h26UX-0000ki-4V for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 03:48:13 +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 1h26UW-0000io-Pj for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 03:48:12 +0000 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h26UT-0002i0-Vp for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 03:48:12 +0000 Received: by mail-oi1-x22d.google.com with SMTP id z14so14845048oid.0 for ; Thu, 07 Mar 2019 19:48:09 -0800 (PST) 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-language; bh=ohrVXIgT42bRlz9Sc7QmB8yAGWVSyDa5jBMXKNX0za4=; b=OIZLgD8K8q0PFm4Wq5N/UToLSwdiSAS6Gi4tRxtdCPOyEUa+M5S06jE0dClZsyQ2+0 9XMFQ8wh0hxgDmd+tKAppoVkRg7BLos2NDOEnCl0u61EhqCmdoMEqVCeZxiMYx4ue8HU +l5kFWFW7/emzx1FtC1FsTvCPWEM8nilK+8gNObFDCOwqo3bZrP1TR/RelpxTej8m9Pt cAnwCxm+ilie8hlgMSI97oGKTi2ZKoXiR5FrFNTltKW7mz7cWSMhQQBxcPHDRNRh3RBj yswdmbT54VGb+eIE9EO3sy49AL7y+dctiqu7B/RwAc3FdondFYSp5Qw10BTPmBOt0rMJ m5lg== 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-language; bh=ohrVXIgT42bRlz9Sc7QmB8yAGWVSyDa5jBMXKNX0za4=; b=m+qNVmEG54Ck9ROy+KWiTh6s/eN6cMgsz4RY2BRhmLwbeRfotQ9LwkOAgA+KWG2G2l Q3zX0WUf3i34ed4aykhrKNkNv9P31BWnWISE32QSfMaki6rupIEovlxkXjaPPI4Adqdt O76KYuKNgzhbSrbtwExR6Kkd+cceUle5Clencgkz3F6jSUBc04yiQnNxwRIiyq1/Vwbe 9xldQ40hK8L79ZEX1eIGSy+SohB/jOHbwbZ1wL57r6MhP4mW8Wd81Xl7NyUrYecDIkpd nYhLAM04+2SxCJgV7232v3WMZ7AgoJl/SlYQxSAfAjjuyAgQweqTKbur8oFM9JPwFuB+ U5XA== X-Gm-Message-State: APjAAAVD5opAkenbYHxO5u6YOk0KwHdQUOJrjxeLUMamwhad/nYPfDtc ACqRHEBNuTbpJxUCkMOO6A22fWWz X-Google-Smtp-Source: APXvYqxfi690X/RQVJYioqdBGtT6IpCIbLaFPTHwI94VsFzJOqdDJhEpyqke5UFbE5xN24y3tf/NGQ== X-Received: by 2002:aca:bf85:: with SMTP id p127mr6728285oif.4.1552016886966; Thu, 07 Mar 2019 19:48:06 -0800 (PST) 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 r132sm2592178oie.20.2019.03.07.19.48.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 19:48:06 -0800 (PST) Subject: Re: partial data migration To: "pgsql-general@lists.postgresql.org" References: <3d0f1ba5-5f70-ad05-73bf-072aa7d0d6df@gmail.com> <313d443d-bfa4-f70d-c984-961343d6b64a@gmail.com> From: Ron Message-ID: Date: Thu, 7 Mar 2019 21:48:05 -0600 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: Content-Type: multipart/alternative; boundary="------------736BC60060FCF08E5B35A79A" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------736BC60060FCF08E5B35A79A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Yes, for whole tables (even sets of tables) "pg_dump --table=" is good at that.  Even better, you can run the 9.6 pg_dump against the 8.3 database and get parallelism with "--jobs". On 3/7/19 8:11 PM, Julie Nishimura wrote: > Ron, thanksagain. In case if I need to migrate the entire tables, I should > be able to use pg_dump and pg_restore for certain tables, even between > different versions, right? In case if I need to migrate from 8 to 9? > > Thanks > > ---------------------------------------------------------------------------- > *From:* Ron > *Sent:* Thursday, March 7, 2019 5:59 PM > *To:* pgsql-general@lists.postgresql.org > *Subject:* Re: partial data migration > (8.3?  That's even older than what we just migrated from!!!) > > No.  Make some views (I'd probably make them "month-sized"), COPY each > view from the source db to a file, and then COPY each file to it's > relevant target table. > > You should also think about a program named pg_bulkload. > > https://www.postgresql.org/docs/9.6/sql-copy.html > https://www.postgresql.org/docs/8.3/sql-copy.html > > > On 3/7/19 7:53 PM, Julie Nishimura wrote: >> Thank you Ron! What if dev environment is on 9.6, but prod is on version >> 8.3? Will posgtres_fdw still be the right option? >> >> Sent from my iPhone >> >> On Mar 6, 2019, at 11:57 PM, Ron > > wrote: >> >>> On 3/7/19 1:54 AM, Julie Nishimura wrote: >>>> Hello psql friends, >>>> We need to migrate only 6 months worth of data from one instance to >>>> another. What would be the easiest way to do it? In Oracle, I would set >>>> up dblink. What about postgresql? >>> >>> postgres_fdw >>> > > -- > Angular momentum makes the world go 'round. -- Angular momentum makes the world go 'round. --------------736BC60060FCF08E5B35A79A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Yes, for whole tables (even sets of tables) "pg_dump --table=" is good at that.  Even better, you can run the 9.6 pg_dump against the 8.3 database and get parallelism with "--jobs".

On 3/7/19 8:11 PM, Julie Nishimura wrote:
Ron, thanksagain. In case if I need to migrate the entire tables, I should be able to use pg_dump and pg_restore for certain tables, even between different versions, right? In case if I need to migrate from 8 to 9?

Thanks


From: Ron <ronljohnsonjr@gmail.com>
Sent: Thursday, March 7, 2019 5:59 PM
To: pgsql-general@lists.postgresql.org
Subject: Re: partial data migration
 
(8.3?  That's even older than what we just migrated from!!!)

No.  Make some views (I'd probably make them "month-sized"), COPY each view from the source db to a file, and then COPY each file to it's relevant target table.

You should also think about a program named pg_bulkload.

https://www.postgresql.org/docs/9.6/sql-copy.html
https://www.postgresql.org/docs/8.3/sql-copy.html


On 3/7/19 7:53 PM, Julie Nishimura wrote:
Thank you Ron! What if dev environment is on 9.6, but prod is on version 8.3? Will posgtres_fdw still be the right option? 

Sent from my iPhone

On Mar 6, 2019, at 11:57 PM, Ron <ronljohnsonjr@gmail.com> wrote:

On 3/7/19 1:54 AM, Julie Nishimura wrote:
Hello psql friends,
We need to migrate only 6 months worth of data from one instance to another. What would be the easiest way to do it? In Oracle, I would set up dblink. What about postgresql?

postgres_fdw


--
Angular momentum makes the world go 'round.

--
Angular momentum makes the world go 'round.
--------------736BC60060FCF08E5B35A79A--