Greetings, I am trying to get a feel of how MySQL would handle certain types of situation, mainly concerning the usage of indices.
Say I have two exactly identical table structures namely table A & B. For table A, I just have one composite primary key on (Code, Date1 & Date2). For table B, I just have composite primary key on (Code, Date1 & Date2) and two non-unique keys on Date1 & Date2. Question is, Will I find any performance improvement with table B, If all my queries start with Code field ? In other words : Will there be any noticiable difference in speed for query "Select * from tableB where code = cd and dt1 > $one_year_ago" over the same query on tableA ? Kindly note that we might have 1000 or more records for each code. When I tried to do an explain, it suggested in both the cases (on tableA & on tableB) that It will use composite primary key (mainly because left most field in the primary index is avaliable)....suggesting that the non-unique indices are pretty much a waste of space...Is that really the case? Woudln't it be "optimal" to use primary key + non-unique key combination to narrow down the search? I would greatly appreciate your insight in this issue. TIA Manoj -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]