php-general Digest 23 Oct 2011 05:52:39 -0000 Issue 7533
Topics (messages 315395 through 315395):
fetchOne vs. fetchAll vs. Sql's limit
315395 by: AmirBehzad Eslami
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Dear list,
As you already know, there are different ways to retrieve a record-set
from a database. For example, here's the classic way to perform this in PHP:
while ($row = mysql_fetch_assoc($db)) {
// my row is available here
}
Speacking about PHP internals, what exactly happens here?
1) The PHP asks the Database-Layer to give a record in each while pass?
I mean the record-set is not available in PHP's memory, but in MySQL's Mem.
2) Or the database-layer has gave the whole result-set to PHP, and we're
just fetching a single row from PHP's memory?
3) Finally, what is the efficient way to retrieve thousands or records which
need to be processed at once? Using LIMIT?
Kind regards,
-behzad
--- End Message ---