>[EMAIL PROTECTED] (Perrin Harkins) wrote:
>>> I guess that DBI gets all records if you use fetchall_array|hashref
>>> and that it is else OK.
>>
>>No, the behavior that I saw was when fetching a row at a time. Behind the
>>scenes, DBI would fetch ALL the rows into RAM and then iterate over them.
>>This may have been changed since then. It was a couple of years ago.
>
>It's still true, mysql will fetch all records at once, whether you ask
>for them or not. You can control it with mysql_(use|store)_result,
>which is documented as a feature so I think it's not going away anytime
>soon.
mysql_store_result/mysql_use_result determine whether or not the server
sends all the rows to the client at once, or one at a time as the client
asks for them. mysql_store_result is therefore more memory intensive
for the client (which must hold the entire result set).
mysql_use_result is less memory intensive for the client, which needs
memory only for one row at a time, but can cause other processes trying
to use the server to block, because the tables from which you're
retrieving rows are read-locked for the duration of the query (that is,
until the client actually fetches the last row).
>
>
> ------------------- -------------------
> Ken Williams Last Bastion of Euclidity
> [EMAIL PROTECTED] The Math Forum