I have a table which constantly grows. In selects I need only the (chronologically) last inserted x rows. The solution ORDER by timestamp DESC LIMIT x is a poor solution, since it is an O(n) case for the DBMS. Is there an elegant (probably mysql-proprietary) SQL-solution for this ?
My solution is an extra table which holds only the last x inserted rows. That means I will delete older rows regularly, so mysql has to scan no more than x records... --Andy --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php