Re: Archeiving and Purging

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Archeiving and Purging
Date: 2015-03-19 04:01:33
Message-ID: CAKFQuwZPzq34D-2-T07tqy+giS7YB8pOG9R7gX1eceNGftbYEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, March 18, 2015, John R Pierce <pierce(at)hogranch(dot)com> wrote:

> On 3/18/2015 7:20 AM, adityagis wrote:
>
>> I have lots of data in my DB. I need to do archeiving and purging of my
>> data.
>> Can anyone please help me with step by step riles?
>>
>
> like this?
>
> select * from table where datefield < current_date-interval '6 months';
> delete from table where datefield < current_date-interval '6 months';
>
> obviously, save the data you selected in a suitable archive file. repeat
> this for each table you wish to 'archive and purge'.
>
> alter the interval with whatever criteria you want to use for this archive
> and purge operation.
>
>
>
Or, pg_dump followed by a drop database...maybe followed by pg_restore
(schema only)...

Probably suggest a COPY ... TO, via psql or or the server depending, if
doing a partial archive.

Not sure what step-by_step commands should be used given the lack of o/s,
client libraries, or intended result specifics. The documentation,
postgresql and/or operating system, will tell how but passing in the proper
"arguments" requires more knowledge than has been provided.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2015-03-19 05:37:48 Re: Name spacing functions and stored procedures
Previous Message John R Pierce 2015-03-19 03:32:56 Re: Archeiving and Purging