Re: Additive backup and restore?

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Additive backup and restore?
Date: 2023-05-08 13:36:28
Message-ID: c1c143cd-5006-b411-2b4e-2807aed6f67e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/8/23 05:24, Age Apache wrote:
> I am designing a database for a web application. In the near future I will
> require past data for Audit, Security and Analysis purpose. But storing
> all that data will increase the database size. What are some well known
> approaches to archiving data for later use without increasing the database
> size?
>
> One approach I am thinking of is compressed additive backup

Additive?

Why not one compressed archive file per month per table?

> and restore i.e. copy the rows of the tables that will be required later
> and store them in a compressed form, and then delete those rows from the
> table. And when the data is required then restore them from the backup
> files in an additive way.
>
> Is there an easy way to achieve this, say via pg_dump?

If the tables are partitioned on the relevant date field, then archiving old
data will be "trivially" easy.

If not, then it'll still be "easy":
- COPY TO a file
- compress it
- store it somewhere.

Reverse to "de-archive" the data.

--
Born in Arizona, moved to Babylonia.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-05-08 13:43:38 Re: huge discrepancy between EXPLAIN cost and actual time (but the table has just been ANALYZED)
Previous Message Kent Tong 2023-05-08 12:29:09 huge discrepancy between EXPLAIN cost and actual time (but the table has just been ANALYZED)