PDO::fetchAll vs. PDO::fetch in a loop

Posted by Byron on Stack Overflow See other posts from Stack Overflow or by Byron
Published on 2010-05-05T04:31:40Z Indexed on 2010/05/05 4:38 UTC
Read the original article Hit count: 562

Filed under:
|
|
|

Just a quick question.

Is there any performance difference between using PDO::fetchAll() and PDO::fetch() in a loop (for large result sets)?

I'm fetching into objects of a user-defined class, if that makes any difference.

My initial uneducated assumption was that fetchAll might be faster because PDO can perform multiple operations in one statement while mysql_query can only execute one. However I have little knowledge of PDO's inner workings and the documentation doesn't say anything about this, and whether or not fetchAll() is simply a PHP-side loop dumped into an array.

Any help?

© Stack Overflow or respective owner

Related posts about pdo

Related posts about fetch