Re: Table Export & Import - Mailing list pgsql-general

From Michel Pelletier
Subject Re: Table Export & Import
Date
Msg-id CACxu=vKjzmRqqtak6D3QrxxBc7_paeYpj40UFTuRqMD97pERgA@mail.gmail.com
Whole thread Raw
In response to Table Export & Import  (Sathish Kumar <satcse88@gmail.com>)
List 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@gmail.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


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Table Export & Import
Next
From: Sathish Kumar
Date:
Subject: Re: Table Export & Import