Subject | Record versioning/timestamping |
---|---|
Author | gregatacd |
Post date | 2004-12-21T01:16:35Z |
DB: Firebird 1.5
I'm looking for a way to mark a record as being updated. For
example, I read a record with a timestamp or other mark, then when I
update it (after the user enters some changes etc.), I find that the
mark has changed somehow (another user updating the record
underneath me).
What would be the best way to mark a record as updated or added?
One potential solution would be to create a timestamp column and
have an update/insert trigger update the timestamp column each time.
Is there a performance issue with this (since getting the current
time may not be overly quick, and it must be done once per
update/insert).
Or, add a 64bit integer column and have the triggers do a +1 on this
column... would this be 'atomic' enough given that multiple users
may be editing a given record...
Any advice here on best practices would be great!
Greg
I'm looking for a way to mark a record as being updated. For
example, I read a record with a timestamp or other mark, then when I
update it (after the user enters some changes etc.), I find that the
mark has changed somehow (another user updating the record
underneath me).
What would be the best way to mark a record as updated or added?
One potential solution would be to create a timestamp column and
have an update/insert trigger update the timestamp column each time.
Is there a performance issue with this (since getting the current
time may not be overly quick, and it must be done once per
update/insert).
Or, add a 64bit integer column and have the triggers do a +1 on this
column... would this be 'atomic' enough given that multiple users
may be editing a given record...
Any advice here on best practices would be great!
Greg