Re: Table Export & Import

From: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>
To: Sathish Kumar <satcse88(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Table Export & Import
Date: 2019-04-01 14:40:38
Message-ID: CACxu=vKjzmRqqtak6D3QrxxBc7_paeYpj40UFTuRqMD97pERgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

As other have pointed out, you can take a pg_dump at anytime. You can
provide arguments to pg_dump to only dump a subset of the database (like
one table). Also mentioned is using a foreign data wrapper (FDW). yet
another approach is to use the "copy to/from program" command to stream the
table from one db to the other using netcat (nc):

On destination server:

\copy table_name to program "nc origin_server 9999";

On origin server:

\copy table_name from program ''nc -l 9999";

If your network is slower than your cpu you can compress the data by piping
it through lz4 (or gzip/bzip whatever, but lz4 is fast both directions for
streaming).

-Michel

On Sun, Mar 31, 2019 at 11:10 PM Sathish Kumar <satcse88(at)gmail(dot)com> wrote:

> Hi Team,
>
> We have a requirement to copy a table from one database server to another
> database server. We are looking for a solution to achieve this with lesser
> downtime on Prod. Can you help us with this?
>
> Table Size: 160GB
> Postgresql Server Version: 9.5
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sathish Kumar 2019-04-01 14:47:27 Re: Table Export & Import
Previous Message Adrian Klaver 2019-04-01 14:22:30 Re: Table Export & Import