Jump to content

Mysql result set storage in memory.


Slips

Recommended Posts

 

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

 

Link to comment
https://forums.phpfreaks.com/topic/209340-mysql-result-set-storage-in-memory/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.