Re: historical log of data records

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Sanjay Minni <sanjay(dot)minni(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: historical log of data records
Date: 2021-11-16 15:42:46
Message-ID: d9774cb3937dcc9519a348e7a9f428d778e2adf7.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2021-11-16 at 15:24 +0530, Sanjay Minni wrote:
>
> On Tue, 16 Nov 2021 at 14:50, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> > 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.
>
> Are you referring to Table Partitioning ?
> https://www.postgresql.org/docs/14/ddl-partitioning.html

Yes, exactly.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Gauthier 2021-11-16 15:54:24 How is JSON stored in PG ?
Previous Message Дмитрий Иванов 2021-11-16 13:56:00 Re: pg_restore depending on user functions