On Sat, Jan 04, 2003 at 03:25:00PM +0200, Victoria Reznichenko wrote: > On Saturday 04 January 2003 14:53, harm wrote: > > > > Your order by will not use your weg_2 index because, as you stated, > > > weg_2 index is on (col1, col2, col3, nr) as a group so it wont be used > > > for the individual columns as you need > > > > > > try to create a separate index on just the nr column, that should be used > > > by the orderby clause. This way your weg_5 will be used for the where > > > (the 3 col) and the new index will be for the orderby > > > > There is an index on 'nr', it is the primary key :) > > > > > > This is one of the examples from the manual which is supposed to use the > > index for the order by: > > > > SELECT * FROM t1 WHERE key_part1=constant ORDER BY key_part2 > > > > Looks like the same situation to me. > > I tested it on 4.0.7 and MySQL picks up right index. > What is your table structure?
Anybody else who has any idea why the index are not used as they should? Thanks, Harmen -- The Moon is Waxing Crescent (22% of Full) nieuw.nl - 2dehands.nl: 58470 --------------------------------------------------------------------- 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