mysql query takes 145 seconds

Posted by suomee on Stack Overflow See other posts from Stack Overflow or by suomee
Published on 2012-06-28T09:14:53Z Indexed on 2012/06/28 9:15 UTC
Read the original article Hit count: 147

Filed under:
|
|

I have a a mysql db with myisam engine. Along with many other table I have this table "et" which has around 8137037 records.

I have created indexes (individual index of column hname and pnum, it did not help much later created joint index of hname and pnum and it help execute within a second)such that queries like "select st from et where hname='name' and pnum='1' limit 1;" execute fast (with in a second) but the problem is I must execute this query "select st from et where hname='name' and pnum='1' order by id limit 1" where id is the primary key of the table and this query sometimes take 145 seconds :(

how can i resolve this issue?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql