in reply to Counting all records but selecting only a few
SELECT COUNT(*) from <table>; [download]
I suggest you do that first, to get the count, then SELECT your last 500.
Memory fault -- brain fried