SELECT not using index (slow web response)
| From: | John Steele | Date: | Fri, 17 Nov 2000 12:43:56 +0000 |
| Subject: | SELECT not using index (slow web response) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25957@lists.php.net to get a copy of this message | ||
Hello,
I'm trying this message here, since I've received no answer to it in the MySQL mailing
list. I would sure like to know what is going on here. The records aren't great in number,
but they are large in size...
> Here's a part of the table definition:
>
>CREATE TABLE plants (
> id INT NOT NULL auto_increment,
> class VARCHAR(5) NOT NULL,
>...
> PRIMARY (id),
> KEY class (class)
> );
>
>SELECT * FROM plants WHERE class='a';
>
> According to EXPLAIN, only my home system is using the index:
>
>MySQL Version table type possible_keys key key_len ref rows Extra
>------------- ----- ---- ------------- --- ------- --- ---- -----
>3.21.29a-gamma plants ref class class 5 a 19 where used
>3.22.21 plants ALL class 876 where used
>3.22.30-log plants ALL class 876 where used
>
> Are these 3.22 versions not actually using the key? The reason I ask is
>that my home system executes this in under 10 seconds (PHP/MySQL) and it
>takes over 45 on the other two systems, both of which have better hardware.
>
> My system is win95, the other two are a Raq(MIPS linux), and FreeBSD.
>Looking at the Raq according to top, httpd goes to 97% CPU usage. It's not
>my system, so I am trying to figure out what is taking so long so that I can
>pass it on to the sysadmin.
>
>Any pointers where to look? Thanks,
> John
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
* We also walk dogs... PHP/MySQL/Linux/Hosting - jsteele@writeme.com
* http://www.steelesoftconsulting.com
*/