MySQL Forums
Forum List  »  Performance

Order performance problem..
Posted by: Joost
Date: December 14, 2006 04:56AM

Hi all,

I have an ORDER BY performance problem.
When I select using the following query:

SELECT entries.* FROM entries WHERE
MATCH (name, info) AGAINST ('+test*' IN BOOLEAN MODE) AND
( entries.lat BETWEEN 51.9493437994359 AND 52.6380634494006 ) AND
( entries.lng BETWEEN 4.17205810546875 AND 5.40802001953125 )
LIMIT 6;

Everything is damn quick (<1sec on about 500.000 rows) using the lat/lng index (see my other Topic :)

But when I add 'ORDER BY order DESC' to this query..it get really slow (read: 8 seconds or something).

Here is the EXPLAIN result:

select_type: SIMPLE
table: entries
type: range
possible_keys: lat,lng
key: lat
key_len: 8
ref: NULL
rows: 273074
Extra: Using where; Using filesort

So..I understand out of this?! that sorting 273074 rows is pretty tough .. but isn't there any way of getting this query faster?? I tried adding lat_order and lng_order indexes..but it did not help..

ANY help would be really great! :) Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Order performance problem..
1424
December 14, 2006 04:56AM
886
December 14, 2006 06:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.