How to efficiently make an "history" ?

From: kesako <kesako_at_mail.com>
Date: Wed, 29 Aug 2001 19:53:23 +0200
Message-ID: <9mja6i$qb8$1_at_news1.span.ch>



Hello,

Here is the target: we want to be able to have a list of fields (Name, description, age, city, ...) describing an entity. The number of fields is not fixed and can be quite large. Furthermore, when a user, from the front-end, updates a particular field, we want to have a revision comment and to keep all old data i.e. change 'name' from 'james' to 'bob' with revision comment 'he prefers shorter names...'.

To reach this goal, one possibility was to have a single table with these fields:

with PK being composed of InsertionDate and FieldName. Until now, do you think this is ok or would you have a better idea/scheme?

The problem now is how to efficiently query this data. Typical requests:

  • More recent values entered for fields named 'name', 'city' and 'country'
  • Last values entered on the 27th of August 2000 for fields named 'name', 'city' and 'country'
  • Historic of the Ten (or twenty, or...) last values entered on the 27th of August 2001 for the fields named 'name, 'city' and 'country'.

and so on...

How to efficiently write these queries, possibly by limiting the number of individual queries. As we are in a multitier system, each query is a network round-trip and I would prefer not use Stored procedure in a first approach.

Any hint, advice, ... would be really helpful.

Cheers,

                  Sacha
Received on Wed Aug 29 2001 - 19:53:23 CEST

Original text of this message