MySQL speed

Discussion in 'Programming' started by N_F_S, Nov 6, 2006.

  1. #1
    So, most of you heard that when you have lots of records containing date field and you show the page in ASC or DESC order by date it slows down things.

    Here is my question, will it be faster if we convert date field into integer (strip '-' signs) and then run the same query (ASC/DESC by date) ?

    IMHO it should be faster, just can't bother doing tests, and want to hear from some experts here:)
     
    N_F_S, Nov 6, 2006 IP
    zangief likes this.
  2. 1EightT

    1EightT Guest

    Messages:
    2,646
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just index the data and the reads and sorts should be lightning fast.
     
    1EightT, Nov 6, 2006 IP
  3. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #3
    yup, if all data is non-null, indexed, and truly a date, sorting a date field should be wicked fast :)
     
    ccoonen, Nov 6, 2006 IP
  4. N_F_S

    N_F_S Active Member

    Messages:
    2,475
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #4
    you mean to create an index on date field?
     
    N_F_S, Nov 7, 2006 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'd have to agree with ccoonen: if you are storing it as a DATE type (as opposed to a string or an int) you shouldn't have too many problems...
     
    TwistMyArm, Nov 7, 2006 IP
  6. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #6
    EXPLAIN [i]your query here[/i]
    Code (markup):
    Will tell you everything you need to know ;)
     
    SoKickIt, Nov 7, 2006 IP