Bug Report:

Version: 3.23.51-max
OS: Windows ME

Problem:
Synopsis: Does not use index when ordering records on datetime field in
the descending order, even though though this field is NOT NULL.

I created the following table:

CREATE TABLE Threads (threadID int NOT NULL PRIMARY KEY,
                      forumID int NOT NULL REFERENCES Forums(forumID),
                      discussion char(100),
                      starter char(40),
                      num_replies int,
                      last_modified datetime NOT NULL,
                      INDEX (forumID, last_modified));

When I execute the following query with explain word I notice that index
is not used:

explain select * from Threads
where forumID = 1 order by last_modified desc;

If I want to select these records in the ascending order, than the index
IS used.

Thanks,
Greg Vinogradov


---------------------------------------------------------------------
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

  • ... George Mihalcea
    • ... Sinisa Milivojevic
  • ... Heikki Tuuri
  • ... Chris McCormick
  • ... Heikki Tuuri
  • ... atsushi
    • ... Miguel Angel Solórzano
  • ... Кулаков Сергей
  • ... Michael Cook
    • ... Sinisa Milivojevic
  • ... Grigoriy Vinogradov
    • ... gerald_clark
  • ... Quasimodo
    • ... Mark Matthews
  • ... Douglas
    • ... Egor Egorov
  • ... Douglas
  • ... Douglas
  • ... Egor Egorov
  • ... Kevin Carrigan
  • ... Heikki Tuuri

Reply via email to