I need to record a set of data items. For each data item, users may modify to some new content. So, I plan to use a timestamp field for each data item to record the time when user modifies data item last time.
I am not sure whether I should use a simple integer value (like version information, which increase 1 each time when user modifies data item)?
Which approach is better? What are the advantages and disadvantages of each approach?
thanks in advance,
>Which approach is better? What are the advantages and disadvantages of each approach?
Unfortunately, your question is very vague. Which is better depends heavily on how you plan to use that data. Can you be more specific?
If youre planning on going for full versio-control of changes, I'd suggest you use both, timestamp and integer value that increments on every change.
Then implement the "real" data to have that integer value as 0, each modification goes to new identity.
So, iterating few changes:
What you benefit from this?
Stamp VIdentity Data
NULL 0 Newest data
2006-08-16 11:00 1 foo
2006-08-16 11:01 2 Second newest data
You can have primary ID for your data that is in relation with other data, say you have dynamic list of Rooms and People and youre storing up data where and when were who.
Just keep the VIdentity matching. This ofcourse means that you get ALOT of data between two lists since each modification escalates the row count while the row count is large. :)
Did I make any sense?
My apologies, I see into your question in highly database-point of view way. It's quite common that some database designs have change history within the tables/relations to track down all changes.
Also, make sure to store value of "who" made the change, if that's available and you can run around accusing those who foobared your data ;)