From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Additive backup and restore?
Date: Mon, 8 May 2023 08:36:28 -0500
Message-ID: <c1c143cd-5006-b411-2b4e-2807aed6f67e@gmail.com> (raw)
In-Reply-To: <CAD80oWbOgVG=EVYukKifnBbhuE8oZ6tL3iAiHUynzJ18n_+f2w@mail.gmail.com>
References: <CAD80oWbOgVG=EVYukKifnBbhuE8oZ6tL3iAiHUynzJ18n_+f2w@mail.gmail.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: Additive backup and restore?
In-Reply-To: <c1c143cd-5006-b411-2b4e-2807aed6f67e@gmail.com>
References: <CAD80oWbOgVG=EVYukKifnBbhuE8oZ6tL3iAiHUynzJ18n_+f2w@mail.gmail.com> <c1c143cd-5006-b411-2b4e-2807aed6f67e@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox