On Wed, Mar 12, 2003 at 10:25:11PM -0700, Jason Brothers wrote: > > I apologize if this topic has been discussed in the past. I am just looking > for feedback whether to use Datetime or Unixtime (32 bit Int) for my > timestamps. From what I can tell here are the advantages and disavantages > of each method: ... > At the moment I am on the fence and would appriciate any feedback or > experience that anyone has.
The issues you mentioned are: - processor time -- I think this one's spurious, - storage space (4 bytes vs 8 bytes) -- shouldn't matter except in cases where you're storing really really large numbers of records (we're only talking about a 4KB difference on a thousand records), - compatibility with 3rd party tools -- which isn't a big issue, since strftime or equiv. is built into most programming languages - user confusion -- shouldn't be an issue, since raw database *should* be hidden from users anyway. I think the more important issues are: - portability -- code using unixtime is less likely to rely on MySQL's date functions, and more easily ported to PostgreSQL, Foxbase, etc. - ease of programming -- if *you* understand unixtimes, it may be faster to use them than refer to various MySQL date manipulation functions in the documentation, Personally, I use both, depending on the requirements of the project. If I know I'm never going to use anything but MySQL, I'll use datetime. If I'm dealing with more than a few million records, I use unixtime. Heck, I sometimes even store IP addresses in unsigned INTs. It all depends on the requirements of the project. -- Paul Chvostek <[EMAIL PROTECTED]> Operations / Abuse / Whatever it.canada, hosting and development http://www.it.ca/ --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php