469,600 Members | 2,235 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

Query with Order By. No index used. why ?

I don't understand

I have this table:
CREATE TABLE product (
p_id int(11) NOT NULL default '0',
p_name varchar(250) NOT NULL default '',
p_cat int(11) NOT NULL default '0',
PRIMARY KEY (p_id),
KEY pp_cat (p_cat),
FULLTEXT KEY p_name (p_name)
) TYPE=MyISAM;

With a simple query like that : "SELECT * FROM `product` WHERE
pp_cat=108"
Explain say that the index 'pp_cat' is used

But with a query like "SELECT * FROM `product` ORDER BY p_cat" or
"SELECT * FROM `product` ORDER BY p_id", Explain that no index is
used, but a simple filesort.

However, queries seems pretty fast and I wonder if it's not just a bug
in EXPLAIN, and if in fact index is used...

I'm with mysql 4.0.17

Thanks
Jul 19 '05 #1
0 968

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Philip Yale | last post: by
6 posts views Thread by Steven D.Arnold | last post: by
3 posts views Thread by Pakku | last post: by
4 posts views Thread by ED | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.