MySQL-PHP Optimization

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Zamees
Forum Newbie
Posts: 19
Joined: Mon Oct 06, 2003 11:27 am

MySQL-PHP Optimization

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It likely has to do with internal optimization, caching and your settings in MySQL rather than anything PHP does.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

just curious -- how much time does it take to fetch 74 rows, 200 rows, 500 rows... ?
Post Reply