Re: Postgres table contents versioning

Lists: pgsql-general
From: John Gage <jsmgage(at)numericable(dot)fr>
To: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Postgres table contents versioning
Date: 2010-06-30 13:49:05
Message-ID: 6E73666A-373D-475E-A474-AA43932541B9@numericable.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is there an equivalent of svn/git etc. for the data in a database's
tables?

Can I set something up so that I can see what was in the table two
days/months etc. ago?

I realize that in the case of rapidly changing hundred million row
tables this presents an impossible problem.

The best kludge I can think of is copying the tables to a directory
and git-ing the directory.

Thanks,

John


From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres table contents versioning
Date: 2010-06-30 13:54:13
Message-ID: 20100630135413.GI2024@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

In response to John Gage :
> Is there an equivalent of svn/git etc. for the data in a database's
> tables?
>
> Can I set something up so that I can see what was in the table two
> days/months etc. ago?

You can use tablelog:

15:53 < akretschmer> ??tablelog
15:53 < pg_docbot_adz> For information about 'tablelog' see:
15:53 < pg_docbot_adz> http://andreas.scherbaum.la/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html
15:53 < pg_docbot_adz> http://pgfoundry.org/projects/emaj/
15:53 < pg_docbot_adz> http://pgfoundry.org/projects/tablelog/

--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99


From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres table contents versioning
Date: 2010-06-30 14:06:31
Message-ID: m3lj9wd388.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

John Gage <jsmgage(at)numericable(dot)fr> wrote:

> Is there an equivalent of svn/git etc. for the data in a
> database's tables?

> Can I set something up so that I can see what was in the
> table two days/months etc. ago?

> I realize that in the case of rapidly changing hundred
> million row tables this presents an impossible problem.

> The best kludge I can think of is copying the tables to a
> directory and git-ing the directory.

If you're looking at this from a disaster recovery point of
view, you should read up on PostgreSQL's PITR capabilities.
If you need the information in your application, you should
google for "temporal databases" on how to amend your table
structures.

Tim


From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres table contents versioning
Date: 2010-06-30 22:22:28
Message-ID: 87zkycyxcr.fsf@cbbrowne.afilias-int.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

jsmgage(at)numericable(dot)fr (John Gage) writes:
> Is there an equivalent of svn/git etc. for the data in a database's
> tables?
>
> Can I set something up so that I can see what was in the table two
> days/months etc. ago?
>
> I realize that in the case of rapidly changing hundred million row
> tables this presents an impossible problem.
>
> The best kludge I can think of is copying the tables to a directory
> and git-ing the directory.

There's a whole set of literature on the notion of temporal data.

Richard Snodgrass' book is rather good.
<http://www.cs.arizona.edu/people/rts/>

The typical approach involves adding a timestamp or two to tables to
indicate when the data is considered valid. That's rather different
from Git :-).
--
output = ("cbbrowne" "@" "gmail.com")
http://linuxdatabases.info/info/languages.html
HEADLINE: Suicidal twin kills sister by mistake!