MySQL Forums
Forum List  »  Performance

Re: SELECT *
Posted by: KimSeong Loh
Date: May 16, 2005 08:16PM

The difference with the following is the sorting required with the ORDER BY
SELECT * and ORDER BY RAND()

This one reads all rows from the table, but does not need to sort
SELECT col1, col2, col3 (...) FROM big_table

If you need to sort lots of data, try to increase the sort_buffer_size
Take a look at the status variable sort_merge_passes to check if you should increase the sort_buffer_size further, try to get as small sort_merge_passes as possible, 0 is best if you have sufficient memory to do in-memory sorting.
Of course, if you select only needed columns, the sorting may require less memory.

Options: ReplyQuote


Subject
Views
Written By
Posted
2525
May 06, 2005 03:15AM
1291
May 16, 2005 04:07PM
Re: SELECT *
1711
May 16, 2005 08:16PM
1696
May 22, 2005 02:03PM


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.