From: | Jonathan Vanasco <postgres(at)2xlp(dot)com> |
---|---|
To: | Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Versioning |
Date: | 2007-04-10 20:52:38 |
Message-ID: | 80581214-E442-4985-9321-18982C72F284@2xlp.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Apr 10, 2007, at 3:18 PM, Sean Davis wrote:
> 4) Maintain a shadow table with only diffs from the original and
> metadata on
> when the changes took place
Thats what I do.
Table artist
id serial primary key
version_id serial
version_date
name
unique key artist_id_version on artist( id , version_id );
Table artist_archive
archive_id serial primary key
id int references artist(id);
version_id
version_date
name
unique key artist_id_version on artist( id , version_id );
I just record the an archive id in the new table, and bump-up an
internal version id + version date on both.
any other metadata goes into its own transaction_details table. i
opted for duplicating the version date into those tables because it
is often used and the speed/memory improvement from not joining
offset the disk space.
the only thing worth mentioning, is that this sort of archive is a
PITA to handle unless you enter a record in both tables as record 0.
ie, every new insert puts the full data in both tables. its possible
to reconstruct information otherwise, but its a headache.
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-04-10 21:42:46 | Re: plperl "set-valued function" problem |
Previous Message | Peter Eisentraut | 2007-04-10 20:52:11 | Re: Do I need serializable for this query? |