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 1h24nh-0004c9-NW for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 01:59:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h24ng-0006wy-9Z for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 01:59:52 +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 1h24nf-0006sj-Oq for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 01:59:51 +0000 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h24nc-0004UH-Tv for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 01:59:50 +0000 Received: by mail-oi1-x243.google.com with SMTP id z14so14688577oid.0 for ; Thu, 07 Mar 2019 17:59:48 -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=8HCK8Jc59W6WF8Mh1woK1ahhTbS7VLWjrg5K4qdV5yc=; b=Q72oUc/Aa0mK1eEbqDCBiKKTyr1+mUklBn46Zd80a0qCck7idkzMY29a1S3poqGGq0 yaD6hP3BDgF/UDCbOMkMhBxoaEepir69ujCS9iKzzdJq0USK68Jh4u1JSfgtlqodw8UI i7dHwRvvB1kW9IZ9GDvPdVivgU8wZ5mJvckQn6CVcinaGbIgw3Oh5bA4NQ77LxugRHe7 c7m6OxPe4pAwojC/zs+Idz41su9O6MMb/E3BpOSqMFzjJV1+usxOTYPh92Kn99RLWPyg kLpHhfKwQTHL0ESAc8BwZUec6XfeE3Er2u/RNc2o4p6LP+pVatT8KcLZtjmJrXiABuDg Wjuw== 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=8HCK8Jc59W6WF8Mh1woK1ahhTbS7VLWjrg5K4qdV5yc=; b=O1pm9mf52IkZL8VK3WgnERGHKHe8oN1LC86GZU/KYcHMW5n+xyhORM2Ul7pupWck07 b7c1bKj+UZgxKqhlk0KCSWKkN2dEQzy0varhtywvmR88T4wxqQzSme0I60W11Ar8Uzcx 5Ez9RFHgm2VXQ0pOgP79rlCJRfwliW/+M2Ohz1zMrE02OFQhgvYT7kfPWvltVdbrnKnT 7vLG5HiA5zrBUuzNX6lsB0vsQMxu0QawRVeGBt3dKDUpLJDXtw7cziexvpDiOK3Y6OpB Bxtn11Zrv6IOHwknfWhIC891Zl7tr5sIVaYPEG/QE23jE2PhNvxpYw1QRWmpG2dPCFpe ntZQ== X-Gm-Message-State: APjAAAW9Qr3sFd4tQY/N6GBIgTan4pIeyb+quQgx7+DEJ6zOu/rgHMg6 eaNPYfRLDPhZAZiTdot6W6DFhsKu X-Google-Smtp-Source: APXvYqzFb8Mk813CK2yWomexw/GNo4wX2DXndAcR0p3oyqr/SCbrf0PHgJqnQlAlvIFzlEoRnwsuOg== X-Received: by 2002:aca:d803:: with SMTP id p3mr6543682oig.111.1552010387692; Thu, 07 Mar 2019 17:59:47 -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 h138sm2664375oic.8.2019.03.07.17.59.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 17:59:47 -0800 (PST) Subject: Re: partial data migration To: "pgsql-general@lists.postgresql.org" References: <3d0f1ba5-5f70-ad05-73bf-072aa7d0d6df@gmail.com> From: Ron Message-ID: <313d443d-bfa4-f70d-c984-961343d6b64a@gmail.com> Date: Thu, 7 Mar 2019 19:59:46 -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="------------EEE104C1FFC0950077D565D7" 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. --------------EEE104C1FFC0950077D565D7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit (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. --------------EEE104C1FFC0950077D565D7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit (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.
--------------EEE104C1FFC0950077D565D7--