Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!dshapiro From: dshapiro@Apple.COM (David Shapiro) Newsgroups: comp.databases Subject: Wondering about using datetime as unique key... Message-ID: <48429@apple.Apple.COM> Date: 24 Jan 91 17:42:45 GMT Organization: Apple Computer Inc., Cupertino, CA Lines: 24 I haven't seen anyone talk about using the timestamp as a unique key to table. For heavy tp applications, it seems like a great way to get rid of the contention on the usual NextNumber table (which holds the next unique integer for a table key). Basically, I was wondering if anyone has used this approach and what experiences you've encountered. The positive aspects I see are: Zero wait time for a new key for a table Guaranteed monotonically increasing unique number (date) Drawbacks: Uniqueness depends on the granularity of your timestamp function. Possible duplication if someone screws with the system time. (no one can be using the system during the daylight savings time adjustment) Portability to new platform could require some time manipulations. If the system stays on one platform, I don't see a problem. And in our Sybase system, the timestamp will give a time value to the millisecond, and assuming it is impossible to write to disk a row in less than a ms, no two rows will have the same key/timestamp. Comments? Dave Shapiro Apple Computer