storing query result in arrays: waste of memory?

From: Date: Wed, 24 Jan 2001 07:15:17 +0000
Subject: storing query result in arrays: waste of memory?
Groups: php.db 
Request: Send a blank email to php-db+get-6124@lists.php.net to get a copy of this message
Hi all, I am writing an object-oriented program in PHP, and some of the child objects require similar data to their parents, but from different columns of the same table. Is it better to retrieve the whole table up-front and store it in a session array, or to run the queries seperately each time the data is needed and specify the column targets? My first thought was to store it all in an array, but the problem is that some of the data is CLOB data, and this is for a site that will have may thousands of concurrent users, so I don't want to use up all the server's memory by putting unnecessary things in arrays. Another thought is that you could run the queries up-front and make the query global, but only fetch rows as needed. Any thoughts on this? The bottom line is that I am not sure whether it is worse to run numerous smaller queries, or to run one large query and possibly use more memory. Does running a query bring all the result data to the client up-front anyway? Thanks for any insights! Regards, Tyson Lloyd Thwaites IT&e Limited e-Commerce Division Adelaide (08) 8346 3888 Regards, Tyson Lloyd Thwaites IT&e Limited e-Commerce Division Adelaide (08) 8346 3888

« previous php.db (#6124) next »