MySQL Forums
Forum List  »  Performance

Re: Partial key
Posted by: Ulf Wendel
Date: June 20, 2005 06:41AM

noudshoorn wrote:
> I assume that when an index is used, rows are in
> the order of the index. When I use order by than
> an index is not used in my opinion, but the whole

That's wrong.

One last time: both MySQL and MaxDB use a cost-based optimizer. The optimizer will decide on his own, on base of his statistics/evaluations. if he want's to use an index or not. Both databases profit from ORDER BY . Both databases are able to read an index in it's natural order (always ASCending for MySQL, ASC or DESCending for MaxDB) and in it's reverse order to speed up ORDER BY operations. In case of MyISAM reserve index scans can become a little slower but in all other cases ORDER BY will profit from sorted index structures and the optimizer will decide to use an index to speed up ORDER BY if it's worth it.

In your case, with 12 records, it's hardly worth using an index. Add 1 million rows and everything is fine.

> I can't believe that this seems to be impossible
> or so difficult to accomplish.

Read the manual to learn how to enforce index usages. But your system will not necessarily profit from it.

Ulf



Edited 1 time(s). Last edit at 06/20/2005 12:10PM by Ulf Wendel.

Options: ReplyQuote


Subject
Views
Written By
Posted
3555
June 11, 2005 12:03PM
1815
June 14, 2005 10:42AM
1948
June 14, 2005 02:16PM
1688
June 15, 2005 02:21AM
1688
June 15, 2005 05:16AM
1839
June 15, 2005 06:24AM
5042
June 15, 2005 12:06PM
1747
June 16, 2005 05:07AM
1716
June 16, 2005 07:57AM
1719
June 16, 2005 08:30AM
1774
June 16, 2005 08:50AM
1620
June 16, 2005 10:21AM
2723
June 16, 2005 03:00PM
1721
June 17, 2005 12:00AM
1635
June 17, 2005 01:28AM
1620
June 20, 2005 01:21AM
Re: Partial key
1812
June 20, 2005 06:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.