Обсуждение: how to take export of one year data from large database which contain 4 years of data.

Поиск
Список
Период
Сортировка

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

От
clingareddy@vsoftcorp.com
Дата:

Hi All,

 

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? 

 

Thanks,

Chandrakiran L Please do not print this email unless it is absolutely necessary. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail and destroy all copies of this message and any attachments. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

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

От
Albe Laurenz
Дата:
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

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

От
Thomas Kellerer
Дата:
clingareddy@vsoftcorp.com schrieb am 16.11.2015 um 09:17:
> 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?

I have never used this, but Jailer claims to support exporting a (logical) subset of a database:

http://jailer.sourceforge.ne

Thomas