[eluser]tonanbarbarian[/eluser]
1. have you run the query in phpMyAdmin or similar and seen how long it taks to generate your results?
It is possible that your query takes to long to execute before it even is sent back to PHP.
You may be able to rewrite your query to improve performance, or you may need to add some indexes, or modify your query to use your indexes more effectively to get the database to return your results quicker
2. I understand in some instances that you may need to process 10000+ rows but can you do those 10,000+ rows in batches of 500?
is it possible to loop through and retrieve 500 records at a time keeping count until you have processed 10,000, or however many you need.