On Tue, Jan 07, 2003 at 11:49:05AM +0100, David Bordas wrote:
> > Anybody else who has any idea why the index are not used as they should?
> 
> I've got same things with 3.23.xx and select query through a TCP/IP
> connection.
> I don't know why, but you can solve this issue using the USE INDEX syntax
> for select queries ...
> 
> http://www.mysql.com/doc/en/SELECT.html

Hmmm, that does help. It does not use the filesort anymore.

I cannot use the 'use index' hardcoed in this query (is is not always the
fastest).

I think the following is happening:
A select with only constants and an 'order by' does not use the index
for the orderby if there are 2 indexes which differ only in that the last
one has the 'order by' column append to it.
For example:
select * from foo where a="const" order by b;
indexes: first_index (a), second_index (a,b)

The fix should be easy, drop the first_index (It is useless anyway)
I'll test this hypothesis tonight when I can do the 20 minute taking alter
table :)


Thanks,

Harmen



> 
> 
> David
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 

-- 
                               The Moon is Waxing Crescent (22% of Full)
                                           nieuw.nl - 2dehands.nl: 58501

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to