Page 1 of 1

MySQL-PHP Optimization

Posted: Fri Sep 15, 2006 8:42 pm
by Zamees
Have a few weird occurences going on, and wondering what could be the cause.

I've got a table with 902k records, and I run a query to return 50 of them at a time. The script timer i wrote shows it as .157 seconds to display all of my results. So I turned this down to 20 results, and it drops down to .005 seconds. I started playing with the limit amount and have found out that when I limit 36, it is at the .005 time. But as soon as it gets up to 37 results, it jumps up to the .157 time. Is there some default setting that is making mysql take more time to get the 37 results vs 36 results. I'm guessing its most likely the amount of data returned with the 36 vs 37 results. The data in each record is very tiny, but possibly, once it goes over a certain amount, say 64k, it then has to loop through again?

Just wondering what the cause of this could be in attempt to optimize my code.

Posted: Fri Sep 15, 2006 10:57 pm
by feyd
It likely has to do with internal optimization, caching and your settings in MySQL rather than anything PHP does.

Posted: Sat Sep 16, 2006 12:38 am
by aaronhall
just curious -- how much time does it take to fetch 74 rows, 200 rows, 500 rows... ?