Re: how to take export of one year data from large database which contain 4 years of data.

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'clingareddy(at)vsoftcorp(dot)com *EXTERN*'" <clingareddy(at)vsoftcorp(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: how to take export of one year data from large database which contain 4 years of data.
Date: 2015-11-16 08:31:39
Message-ID: A737B7A37273E048B164557ADEF4A58B50FE492C@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

clingareddy(at)vsoftcorp(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2015-11-16 08:47:09 Re: how to take export of one year data from large database which contain 4 years of data.
Previous Message clingareddy 2015-11-16 08:17:52 how to take export of one year data from large database which contain 4 years of data.