Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku
My account: Login | Sign Up
Loading... 

'Order by' clause not using indexes | Thread profile

Thread profile page for "'Order by' clause not using indexes" on http://www.mysql.com. This report page is a snippet summary view from a single thread "'Order by' clause not using indexes", located on the Message Board at http://www.mysql.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity, which are reported in a table below. Additional thread profile information is also shown in the following ways:

1) Top Contributing Authors
2) Related Threads on "eBay Auctions"
3) Related Threads on Other Sites

Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a thread's popularity and/or exact posting volumes at any given reporting period.

Title: 'Order by' clause not using indexes
Site: MySQL AB - MySQL Forums  MySQL AB - MySQL Forums - site profile
Forum: General   General   - forum profile
Total authors: 2 authors
Total thread posts: 2 posts
Thread activity: no new posts during last week
Domain info for: mysql.com

Thread posts in 'Order by' clause not using indexes:

1. 
Started 4 years, 5 months ago (2005-01-16 04:33:00)  by marius hagiu
how can i make 'order by' use an index? i have the following table:sales with columns id int(4), suma bigint(12), type char(11) and data date with indexes on (id,type) and (suma) im issuing the following statement: select * from vanzari order by suma but it doesnt use the index if i use explain i get type=ALL and using filesort i also tried 'force index' syntax - still the same ...
Size: 523 bytes
Customize:  Customize "'Order by' clause not using indexes :: General   :: MySQL AB - MySQL Forums"
2. 
Started 4 years, 5 months ago (2005-01-17 08:22:00)  by Jonathan Cochran
MySQL will not always use the index if your query is grabbing more than 30% (this # varies) of the total data. I am not positive, but this looks like what is happening in your case. Try using a where clause (WHERE suma = ____ ORDER BY suma), then look at your explain and it should be using the suma index. See this link for a better explanation. [ forums.mysql.com ]
Size: 482 bytes
Customize:  Customize "<b>Reply 1</b>: Re: 'Order by' clause not using indexes :: General   :: MySQL AB - MySQL Forums"
 

Top contributing authors for 'Order by' clause not using indexes

Name
Posts
marius hagiu
1
user's latest post:
'Order by' clause not...
Published (2005-01-16 04:33:00)
how can i make 'order by' use an index? i have the following table:sales with columns id int(4), suma bigint(12), type char(11) and data date with indexes on (id,type) and (suma) im issuing the following statement: select * from vanzari order by suma but it doesnt use the index if i use explain i get type=ALL and using filesort i also tried 'force index' syntax - still the same results what indexes from the above table can...
Jonathan Cochran
1
user's latest post:
Re: 'Order by' clause...
Published (2005-01-17 08:22:00)
MySQL will not always use the index if your query is grabbing more than 30% (this # varies) of the total data. I am not positive, but this looks like what is happening in your case. Try using a where clause (WHERE suma = ____ ORDER BY suma), then look at your explain and it should be using the suma index. See this link for a better explanation. [ forums.mysql.com ]