Whole-row comparison ?

From: <christian(dot)roche(dot)ext(at)nsn(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Whole-row comparison ?
Date: 2007-05-17 12:56:08
Message-ID: CCC9DCA122011F4CA593F6A548BFFBD354D217@esebe111.NOE.Nokia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there,

I'm trying to implement a "versionned" storage for a datawarehouse
system, meaning I have tables which store daily information about
objects and I would like to have a row inserted (i.e. a new version)
only if it differs from the most recent existing row. For instance
instead of storing

version attribute1 attribute2
1 x y
2 x y
3 x y
4 z y
5 z y
6 z t

we would only keep the diffs :

version attribute1 attribute2
1 x y
4 z y
6 z t

This would save lots of space and the full table could be easily
accessed through a view.

However as the tables have a large number of rows (several hundreds) I
would like to avoid having to write conditions like WHERE (old.att1 !=
new.attr1 or old.attr2 != new.attr2 or ... or old.attr245 != new.attr245
)

So my question is: is there a way to do some kind of whole-row
comparison ? For instance a hash of the full row or something similar ?
Is there a standard way of solving this problem ?

Thanks a lot for any hind !
Christian

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Maier 2007-05-17 13:19:48 How can you generate a counter for ordered sets?
Previous Message S balasankaravadivel 2007-05-17 09:43:33 doubt