Lethe Posted March 25, 2009 Share Posted March 25, 2009 General question... If you run a mysql select statement with a lot of records (lets say a 1000 records at most) that you will be reusing multiple times and looping through them recursively is it generally best practice to immediately put the results in an array and free the mysql results? Thanks Link to comment https://forums.phpfreaks.com/topic/151022-solved-mysql_query-and-arrays/ Share on other sites More sharing options...
Yesideez Posted March 25, 2009 Share Posted March 25, 2009 If you put them all into an array imagine - one user accessing 1,000 records that array takes up memory of the web server. If let's say 100 people access it that's 100x1,000 times the amount of memory eaten up. It may be freed at the end but I'd say best to read through the result without passing it to an array unless you need some of the data later on in the script. Link to comment https://forums.phpfreaks.com/topic/151022-solved-mysql_query-and-arrays/#findComment-793395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.