MySQL Forums
Forum List  »  MyISAM

Re: myisamchk sorting records descending
Posted by: JJWR
Date: May 19, 2005 01:03AM

Ulf what I want to do is to sort the rows physically descending in the disk. This is to avoid the 'order by filed DESC' en the querys and to take profit of the LIMIT clause.

Let's suppose that you select 60.000 rows with a full text search query but you only want the first 25 rows (concerning a key and descending) the you will do select * from table where match(textfield) against(...) order by sortfield DESC LIMIT 25
Select 60.000 rows with full text search costs a lot, order 60.000 rows costs a lot... and you only want the first 25 rows.

If you have the records already sorted in the disk (descending) you could do select * from table where match(textfield) against(...) LIMIT 25
This is incredible much faster because full text search engine only have to select the first 25 rows it founds and, also, mysql does no t have to perform a 60.000 rows sorting.

MyIsam does not support clustered indexes, so I must done periodically an offline physical sorting with
myisamchk --sort-index --sort-records=#key_num
The problem is that I need the physical sorting in descending order and myisamchk does not permit this :(

Options: ReplyQuote


Subject
Views
Written By
Posted
6865
April 12, 2005 01:19AM
3206
April 26, 2005 12:50AM
Re: myisamchk sorting records descending
4301
May 19, 2005 01:03AM
2898
April 28, 2005 08:21AM


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.