mysql index help

Discussion in 'MySQL' started by romance, Mar 7, 2006.

  1. #1
    Hi all,

    trying to optimise a table using some indexes but with not much luck, wondering if anyone had any pointers?

    The table is 1.5 million rows big, runing on mysql 5, MyISAM.

    I have a primary key and an index on 2 columns, col1 is a integer with length 4 and col2 is a varchar with length 70.

    I used: ALTER TABLE tablename ADD INDEX(col1(4),col2(30));

    and the query giving me problems is:

    SELECT * FROM tablename where col1=3562 and col2='sometext'

    this takes anything from 5 to 15 seconds to run. Anything obvious i'm missing here?
     
    romance, Mar 7, 2006 IP
  2. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #2
    noppid, Mar 7, 2006 IP