Slips Posted July 30, 2010 Share Posted July 30, 2010 Hi all, im learning mysql,and im using mysql 5.1.36, on a shared host and im developing a site that is aimed at growing large. I cannot afford dedicated hosting for now, but thats a topic for another day. I was just writing some code and wondering if mysql frees a result set from its memory if the $result variable (assuming it stores the result set), is assigned another result set. So, If i assign $result to a large query set, use that to do w/e, then use the $result variable again..does the result set from the first one clear from memory before script execution ends? I know the variable loses the result set, but im wanted to know if the result set still stays in memory until script executin.( in which case id have to free result after each result set usage to get better performance). Thanks Quote Link to comment https://forums.phpfreaks.com/topic/209340-mysql-result-set-storage-in-memory/ Share on other sites More sharing options...
Mchl Posted July 30, 2010 Share Posted July 30, 2010 Once all references to resultset resource are removed (by assigning a different resultset to the variable for example), PHP will try to free memory assigned to this resultset. MySQL does it's own garbage collection once the entire resultset has been sent to the application. Having said all this, manually closing results will not hurt you. Quote Link to comment https://forums.phpfreaks.com/topic/209340-mysql-result-set-storage-in-memory/#findComment-1093110 Share on other sites More sharing options...
Slips Posted August 1, 2010 Author Share Posted August 1, 2010 Ah i see... Yeah manually doing it is not gonna hurt me, maybe a little on the fingers though coz i have to go back to all the scripts where i didnt do it and do so hehe..well atleast its not too much, thanks again for the reply! Quote Link to comment https://forums.phpfreaks.com/topic/209340-mysql-result-set-storage-in-memory/#findComment-1093891 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.