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 1h24zT-0005DF-NX for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 02:12:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h24zS-0002SR-GL for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2019 02:12:02 +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 1h24zR-0002IA-IC for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 02:12:02 +0000 Received: from mail-oln040092002010.outbound.protection.outlook.com ([40.92.2.10] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h24zM-0004p6-Sf for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2019 02:11:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R6d6oflTUfcr4Rh06IN8V39NJNkVkwT1WGcuz7xRGoQ=; b=kZkTiLOiW3hyd/4xOnoBbHeag/ZuPsV68G/q90r5YSaXRgCLydi+nZNPhDECZlQ1/HTHlpt4AJcon9hgG4inESv8/NOQVE25U1dAk4cDB8juaxIPgZ6jAGLUo/+qSdUhUtF9VlKrKpDhGZCvKmJU3KPwFHrKWJ2xZNUP7T48RyElKFb8o9p20fiRwsTVLhsY0oc7SyeFpOzB/O1cWJlN6Dp9a0Dxv9iLFKceEZqu2FcGhtMT1R05mxo60K6OQDaEd9RYEAoMXDEyosxd2I7MHaORWtW92mMP2W+pc8svXOXoH5J0E9SGLrB3NUSJ2aUA0DJfBeJe43asOMpQ+HlXzw== Received: from BN3NAM01FT023.eop-nam01.prod.protection.outlook.com (10.152.66.51) by BN3NAM01HT067.eop-nam01.prod.protection.outlook.com (10.152.67.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1643.11; Fri, 8 Mar 2019 02:11:54 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com (10.152.66.53) by BN3NAM01FT023.mail.protection.outlook.com (10.152.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1643.11 via Frontend Transport; Fri, 8 Mar 2019 02:11:54 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::e141:e5bc:51c5:5bdb]) by BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::e141:e5bc:51c5:5bdb%2]) with mapi id 15.20.1665.021; Fri, 8 Mar 2019 02:11:54 +0000 From: Julie Nishimura To: Ron , "pgsql-general@lists.postgresql.org" Subject: Re: partial data migration Thread-Topic: partial data migration Thread-Index: AQHU1Lq16y2txlfS1UuShIlp5U/xoKX/zT6AgAEswuKAAAG/AIAAAu6z Date: Fri, 8 Mar 2019 02:11:54 +0000 Message-ID: References: <3d0f1ba5-5f70-ad05-73bf-072aa7d0d6df@gmail.com> ,<313d443d-bfa4-f70d-c984-961343d6b64a@gmail.com> In-Reply-To: <313d443d-bfa4-f70d-c984-961343d6b64a@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:F712F9A65B618E31A0532E175B016C8105F0ED5D72CAB948DF76351B5316961A;UpperCasedChecksum:E12FA743CBDC178C21B53787481BC1B4471C94E9229F9052FE05F31E5F3152FD;SizeAsReceived:7038;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [cu47XAZw7BFKWax1CEx8nHV55mfS0sJu] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125500)(1603101475)(1701031045);SRVR:BN3NAM01HT067; x-ms-traffictypediagnostic: BN3NAM01HT067: x-microsoft-antispam-message-info: oWtWHkkdhoftytOAUf65yFeoZ5cT4dp1hUwu44SGZ1fsFmyCxss/HQHe+C8/atyr Content-Type: multipart/alternative; boundary="_000_BYAPR08MB5014325DF2A32036F183E9E3AC4D0BYAPR08MB5014namp_" MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 2ed1a1d2-fe16-4c7c-088e-08d6a36b6f94 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2019 02:11:54.7523 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM01HT067 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_BYAPR08MB5014325DF2A32036F183E9E3AC4D0BYAPR08MB5014namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 diff= erent 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 tar= get 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. --_000_BYAPR08MB5014325DF2A32036F183E9E3AC4D0BYAPR08MB5014namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
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 diff= erent versions, right? In case if I need to migrate from 8 to 9?

Thanks


From: Ron <ronljohnson= jr@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 eve= n 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<= br> https://www.postgresql.org/docs/8.3/sql-copy.html<= br>

On 3/7/19 7:53 PM, Julie Nishimura wrote:<= br>
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?&n= bsp;

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.
--_000_BYAPR08MB5014325DF2A32036F183E9E3AC4D0BYAPR08MB5014namp_--