Re: how to take export of one year data from large database which contain 4 years of data. - Mailing list pgsql-admin

From Albe Laurenz
Subject Re: how to take export of one year data from large database which contain 4 years of data.
Date
Msg-id A737B7A37273E048B164557ADEF4A58B50FE492C@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to how to take export of one year data from large database which contain 4 years of data.  (clingareddy@vsoftcorp.com)
List pgsql-admin
clingareddy@vsoftcorp.com wrote:
> My database contains 4 years of data, but i want to migrate only one year i.e 2015 of data to another
> database.
> 
> Please help me how to take export of one year data. Is there any bus_date condition we can use while
> exporting?

PostgreSQL does not know when a row was created.

If you want to export only part of a table, you can do that with:
COPY (SELECT <part of the table>) TO <filename>;

You'd have to come up with appropriate SELECT statements for each affected table,
and you would end up with one export file per table.

A bit tedious, but it can be done.

Another option would be to create a copy of the database, delete everything
that is old and dump the remaining data.

Yours,
Laurenz Albe

pgsql-admin by date:

Previous
From: clingareddy@vsoftcorp.com
Date:
Subject: how to take export of one year data from large database which contain 4 years of data.
Next
From: Thomas Kellerer
Date:
Subject: Re: how to take export of one year data from large database which contain 4 years of data.