|
Posted by Johannes Keßle on February 8, 2010, 10:06 am
Please log in for more thread options
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
the documentation says:
The returned result resource should be passed to mysql_fetch_array(), and other
functions for dealing with result tables, to access the returned data.
Does this mean that all the data is already fetched from the DB and loaded into
RAM and I only need the mysql_fetch_* functions to extract it ?
eg.
$query = mysql_query("SELECT * FROM `table`");
If in table are rows worth some megaBytes, are those megabytes already loaded
into RAM or is this only happening if if I use mysql_fetch_assoc/array etc.
eg.
$query = mysql_query("SELECT * FROM `table`");
// is the data already here loaded into RAM
while($result = mysql_fetch_assoc($query)) {
$newArray[] = $result;
// or at this point ?
}
regards,
johannes keßler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEARECAAYFAktwKHUACgkQE++2Zdc7Etd1PwCfcJttayTQuImXhipHk5ocdY2M
VdMAn2nZJIyCaThw+zXDRYBaDqx7wJCR
=b1CY
-----END PGP SIGNATURE-----
|
|
Posted by Jerry Stuckle on February 8, 2010, 11:33 am
Please log in for more thread options
Johannes Keßler wrote:
show/hide quoted text
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> the documentation says:
> The returned result resource should be passed to mysql_fetch_array(), and other
> functions for dealing with result tables, to access the returned data.
>
> Does this mean that all the data is already fetched from the DB and loaded into
> RAM and I only need the mysql_fetch_* functions to extract it ?
>
> eg.
>
> $query = mysql_query("SELECT * FROM `table`");
>
> If in table are rows worth some megaBytes, are those megabytes already loaded
> into RAM or is this only happening if if I use mysql_fetch_assoc/array etc.
>
> eg.
>
> $query = mysql_query("SELECT * FROM `table`");
> // is the data already here loaded into RAM
> while($result = mysql_fetch_assoc($query)) {
> $newArray[] = $result;
> // or at this point ?
> }
>
>
> regards,
> johannes keßler
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (GNU/Linux)
>
> iEYEARECAAYFAktwKHUACgkQE++2Zdc7Etd1PwCfcJttayTQuImXhipHk5ocdY2M
> VdMAn2nZJIyCaThw+zXDRYBaDqx7wJCR
> =b1CY
> -----END PGP SIGNATURE-----
These are mysql calls. Try asking in comp.databases.mysql.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
|
|
Posted by Peter H. Coffin on February 8, 2010, 11:37 am
Please log in for more thread options
On Mon, 08 Feb 2010 16:06:30 +0100, Johannes Keßler wrote:
show/hide quoted text
> Hello,
> the documentation says:
> The returned result resource should be passed to mysql_fetch_array(), and other
> functions for dealing with result tables, to access the returned data.
> Does this mean that all the data is already fetched from the DB and loaded into
> RAM and I only need the mysql_fetch_* functions to extract it ?
> eg.
> $query = mysql_query("SELECT * FROM `table`");
> If in table are rows worth some megaBytes, are those megabytes already loaded
> into RAM or is this only happening if if I use mysql_fetch_assoc/array etc.
> eg.
> $query = mysql_query("SELECT * FROM `table`");
> // is the data already here loaded into RAM
> while($result = mysql_fetch_assoc($query)) {
> $newArray[] = $result;
> // or at this point ?
> }
hmmm... If I remember correctly, it doesn't fetch ALL the data
necessarily, just enough to fill the connection buffers. Looping through
and filling an array will (eventually) put all the data into memory (the
array) but that runs the risk of becoming Very Large, possibly too large
for the allowed memory of the php process.
--
93. If I decide to hold a double execution of the hero and an underling
who failed or betrayed me, I will see to it that the hero is
scheduled to go first.
--Peter Anspach's list of things to do as an Evil Overlord
|
|
Posted by matt on February 8, 2010, 2:45 pm
Please log in for more thread options
wrote:
show/hide quoted text
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Hello,
> the documentation says:
> The returned result resource should be passed to mysql_fetch_array(), and=
other
show/hide quoted text
> functions for dealing with result tables, to access the returned data.
> Does this mean that all the data is already fetched from the DB and loade=
d into
show/hide quoted text
> RAM and I only need the mysql_fetch_* functions to extract it ?
> eg.
> $query =3D mysql_query("SELECT * FROM `table`");
> If in table are rows worth some megaBytes, are those megabytes already lo=
aded
show/hide quoted text
> into RAM or is this only happening if if I use mysql_fetch_assoc/array et=
c.
show/hide quoted text
> eg.
> $query =3D mysql_query("SELECT * FROM `table`");
> // is the data already here loaded into RAM
> while($result =3D mysql_fetch_assoc($query)) {
> =A0 =A0$newArray[] =3D $result;
> =A0 =A0// or at this point ?
> }
> regards,
> johannes ke=DFler
You could always run some tests with memory_get_usage()
|
|
Posted by C. (http://symcbean.blogspot.c on February 9, 2010, 7:55 am
Please log in for more thread options
show/hide quoted text
> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > Hello,
> > the documentation says:
> > The returned result resource should be passed to mysql_fetch_array(), a=
nd other
show/hide quoted text
> > functions for dealing with result tables, to access the returned data.
> > Does this mean that all the data is already fetched from the DB and loa=
ded into
show/hide quoted text
> > RAM and I only need the mysql_fetch_* functions to extract it ?
> > eg.
> > $query =3D mysql_query("SELECT * FROM `table`");
> > If in table are rows worth some megaBytes, are those megabytes already =
loaded
show/hide quoted text
> > into RAM or is this only happening if if I use mysql_fetch_assoc/array =
etc.
show/hide quoted text
> > eg.
> > $query =3D mysql_query("SELECT * FROM `table`");
> > // is the data already here loaded into RAM
> > while($result =3D mysql_fetch_assoc($query)) {
> > =A0 =A0$newArray[] =3D $result;
> > =A0 =A0// or at this point ?
> > }
> > regards,
> > johannes ke=DFler
> You could always run some tests with memory_get_usage()
No - the client libs will buffer the results (potentially the complete
result set even before any call to mysql_fetch_....) but outside the
PHP memory area - IIRC memory_get_usage only reports memory allocated
by PHP.
C.
|
| Similar Threads | Posted | | fetch array function | July 2, 2008, 6:12 pm |
| How to "fetch" a certain id | November 16, 2006, 9:07 pm |
| Fetch username | February 10, 2009, 10:13 pm |
| pop3 mail fetch with PHP | August 18, 2005, 4:13 am |
| select on updated value during the fetch | June 16, 2006, 3:52 am |
| Fetch array, display and update, all in one.. ? | September 2, 2004, 1:03 pm |
| Fetch array, display and update, all in one.. ? | September 7, 2004, 1:17 pm |
| Fetch childNodes Array using SimpleXMLElement | September 13, 2009, 5:05 pm |
| IMDB fetch with PowermovieList Hangs for exact matches | May 6, 2008, 9:06 am |
| function to simplify data | September 4, 2005, 10:10 am |
|
> Hash: SHA1
>
> Hello,
>
> the documentation says:
> The returned result resource should be passed to mysql_fetch_array(), and other
> functions for dealing with result tables, to access the returned data.
>
> Does this mean that all the data is already fetched from the DB and loaded into
> RAM and I only need the mysql_fetch_* functions to extract it ?
>
> eg.
>
> $query = mysql_query("SELECT * FROM `table`");
>
> If in table are rows worth some megaBytes, are those megabytes already loaded
> into RAM or is this only happening if if I use mysql_fetch_assoc/array etc.
>
> eg.
>
> $query = mysql_query("SELECT * FROM `table`");
> // is the data already here loaded into RAM
> while($result = mysql_fetch_assoc($query)) {
> $newArray[] = $result;
> // or at this point ?
> }
>
>
> regards,
> johannes keßler
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (GNU/Linux)
>
> iEYEARECAAYFAktwKHUACgkQE++2Zdc7Etd1PwCfcJttayTQuImXhipHk5ocdY2M
> VdMAn2nZJIyCaThw+zXDRYBaDqx7wJCR
> =b1CY
> -----END PGP SIGNATURE-----