Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004

    Unanswered: speed comparison: integer - char(12)?

    hi everyone,
    i need to use a field as a date, i have 3 choices, column type:

    1) DateTime : i dont want to use this because of compability problems.
    2) Char(12) : ex. 041227124356 --> means 2004-12-27 12:43:56 (i use this)
    3) Integer : number of seconds elapsed from 2000-01-01

    my question is that which one is the best (fast)? 2 or 3? (sorting, selecting)
    best regrads,

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    I really wouldn't know the answer to your question - didn't test anything like this. But, I would recommend you to use a DATE datatype to store date values. I *guess* it should be faster than 2 and 3. Why? Because those two solutions require some kind of "transformation" function(s) to represent value as you'd like to see it (that is, not "2450815" but "01-jan-98").

    Of course, I might be wrong; I'm sure there is someone here who'll know it for sure.

    P.S. I had an (Oracle 5) database where date fields were represented as Julian dates (integers). Believe or not, but redesign and use of DATE columns (in Oracle 7) made me feel much better.

  3. #3
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Put all three data types into a scratch table, then test them to see which behaves best. Be sure that all three columns are indexed as you'd expect, and that all of the output is formatted as you'd like.

    I'll bet on the DateTime too.


  4. #4
    Join Date
    Nov 2004
    hmm. i know the best choice is DateTime but my project need to run Oracle / MSSQL / MySQL (and may be PostgreSQL later) so i try to find the most compatible way to store date-time values.

    additionally all there choices needs a "transformation" because of regional settings, so its not a really comparison criteria, i think.

    thank you for your reply, i will try to test 2 and 3 on a mysql server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts