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
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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.