pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Sanjay Minni <sanjay.minni@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: historical log of data records
Date: Tue, 16 Nov 2021 10:20:28 +0100
Message-ID: <6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at> (raw)
In-Reply-To: <CAMpxBo=xMvQOk--tSp7mkChUwfJfbbtSfQE=S6O2pELGSvQvjQ@mail.gmail.com>
References: <CAMpxBo=xMvQOk--tSp7mkChUwfJfbbtSfQE=S6O2pELGSvQvjQ@mail.gmail.com>

On Tue, 2021-11-16 at 13:56 +0530, Sanjay Minni wrote:
> I need to keep a copy of old data as the rows are changed. 
> 
> For a general RDBMS I could think of keeping all the data in the same table with a flag
> to indicate older copies of updated /  deleted rows or keep a parallel table and copy
> these rows into the parallel data under program / trigger control. Each has its pros and cons. 
> 
> In Postgres would i have to follow the same methods or are there any features / packages available ?

Yes, I would use one of these methods.

The only feature I can think of that may help is partitioning: if you have one partition
for the current data and one for the deleted data, then updating the flag would
automatically move the row between partitions, so you don't need a trigger.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (7+ messages)  latest in thread

Message-ID: <6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at>
Permalink:  ../6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at/
Also on:    postgresql.org/message-id/6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at

 · 

reply

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: laurenz.albe@cybertec.at, sanjay.minni@gmail.com
  Subject: Re: historical log of data records
  In-Reply-To: <6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at>
  References: <CAMpxBo=xMvQOk--tSp7mkChUwfJfbbtSfQE=S6O2pELGSvQvjQ@mail.gmail.com> <6e3e5cea05a44013d2dcbfddab96c3d9ad11238b.camel@cybertec.at>

* 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