ioannes wrote:
If you use LIMIT row_count with ORDER BY, MySQL ends the sorting as
soon as it has found the first row_count lines rather than sorting the
whole table.
http://dev.mysql.com/doc/mysql/en/limit-optimization.html
I need to get the top $num results from a completely sorted table (eg
sorted on ID, ie the $num latest inserted rows). Which functions should
I be considering?
LIMIT works that way, the write-up is just confusing. If you ORDER BY
id DESC LIMIT 10, then you'll get the 10 highest values of id in the
result. The write-up just means that MySQL isn't going to bother sorting
the rest of the table after it finds the 10 highest (or whatever your
limit is). Is that what you're after?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php