List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:May 22 1999 8:09pm
Subject:why is "order by" DESC so slow?
View as plain text  
<cut>

>>>>> "Robert" == Robert A Bruce <rab@stripped> writes:

Robert> I have a table of about 900,000 customer addresses, and an interactive
Robert> application that can be used to search the addresses, and scroll through
Robert> them in alphabetical order.  Scrolling forward is no problem, because it
Robert> is easy and fast to get entries directly following a given value.  I can
Robert> get the next 10 values in a twentieth of a second, which is plenty fast
Robert> enough for an interactive application.

<cut>

Robert> But I cannot scroll backwards.  It is very, very slow to get the entries
Robert> that directly precede a value.  The following query takes nearly an hour
Robert> to complete:

mysql> select custnum,name from addresses where name < 'Smith;Joe' order by
Robert>        name DESC limit 10;

<cut>

The problem is that MySQL doesn't yet optimise backward-index
optimisation when searching on ranges;  This is one the TODO and will
be fixed in the near future.

Regards,
Monty
Thread
why is "order by" DESC so slow?Robert A. Bruce17 May
  • Re: why is "order by" DESC so slow?Jim Faucette17 May
  • why is "order by" DESC so slow?Michael Widenius24 May
  • Sync'ing databasesEvan Thomas1 Jun
    • Re: Sync'ing databasesJorge del Conde1 Jun
Re: Sync'ing databasesSheamus Nulty1 Jun