This is a discussion on Whole-row comparison ? within the pgsql Sql forums, part of the PostgreSQL category; --> Hi there, I'm trying to implement a "versionned" storage for a datawarehouse system, meaning I have tables which store ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| ||||
| > 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 ? Sure it is called row wise comparison: http://www.postgresql.org/docs/8.2/i...ISE-COMPARISON you can write something like: SELECT * FROM Your_table WHERE (c1,c2,c3,c4) = ('a',2,'xyz',123); Regards, Richard Broersma Jr. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| Thread Tools | |
| Display Modes | |
|
|