Re: Memory. .

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[FOTOList.com] Suporte wrote:
Hi,

When I get something from database, using this function: pg_query (postgresql) or mysql_query and after put this result in somes variables, Am I using double memory to same data or this new variable point to variable with db result?

The postgresql or mysql process is storing the resultset in memory, php is passed the address of the resultset. When you actually pull the individual rows out of the resultset into PHP and assign them a variable, you are storing a second copy of that. If you pull out all the rows and store them in an array in PHP, you then have two copies of your entire data. If you need to pull your whole set of results out into an array, you can immediately use pg_free_result() or mysql_free_result() afterwards to free up the copy using memory in the database.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux