indexes and desc

2001-09-10 Thread PR

When doing a select that is ordered by a column that is indexed and has a
limit, does mysql not use the index if the order by is descending?

Here's an example:
select parent,number,lastpost from posts where topic=1 and board='abc' and
approved='yes' order by lastpost desc limit 9,12

My app is a message board and I'm using date descending as the order.  

One thought I had is to create a new column like desctime and set the value
of each post to something like the time value for say 1/1/2025 minus the
lastpost time - that should set it far enough out I wouldn't have to every
worry about it.

Another thought I guess would be to just store the value as a negative value.

If it doesn't use the index in descending order, does anyone have any
suggestions on my thoughts here or other ideas on how to work around this
most efficiently?  

And are there future plans for indexing on desc order?


-
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




Re: indexes and desc

2001-09-10 Thread Jeremy Zawodny

On Mon, Sep 10, 2001 at 09:13:06AM -0700, PR wrote:
 
 And are there future plans for indexing on desc order?

This is already fixed in MySQL 4.0.
-- 
Jeremy D. Zawodny, [EMAIL PROTECTED]
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.41-max: up 4 days, processed 99,159,321 queries (254/sec. avg)

-
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