note 116673 added to mysqli-result.fetch-all
| From: | jcastro at eftec dot cl | Date: | Mon, 09 Feb 2015 02:26:39 +0000 |
| Subject: | note 116673 added to mysqli-result.fetch-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201670@lists.php.net to get a copy of this message | ||
I tested using "fetch all" versus "while / fetch array" and :
fetch-all uses less memory (but not for so much).
In my case (test1 and test2): 147008,262848 bytes (fetch-all) versus 147112,262888 bytes
(fetch-array & while.
So, about the memory, in both cases are the same.
However, about the performance
My test takes :350ms (worst case) using fetch-all, while it takes 464ms (worst case) using
fetch-array, or about 35% worst using fetch array and a while cycle.
So, using fetch-all, for a normal code that returns a moderate amount of information is :
a) cleaner (a single line of code)
b) uses less memory (about 0.01% less)
c) faster.
php 5.6 32bits, windows 8.1 64bits
----
Server IP: 72.52.91.14
Probable Submitter: 200.83.252.70
----
Manual Page -- http://php.net/manual/en/mysqli-result.fetch-all.php
Edit -- https://master.php.net/note/edit/116673
Del: integrated -- https://master.php.net/note/delete/116673/integrated
Del: useless -- https://master.php.net/note/delete/116673/useless
Del: bad code -- https://master.php.net/note/delete/116673/bad+code
Del: spam -- https://master.php.net/note/delete/116673/spam
Del: non-english -- https://master.php.net/note/delete/116673/non-english
Del: in docs -- https://master.php.net/note/delete/116673/in+docs
Del: other reasons-- https://master.php.net/note/delete/116673
Reject -- https://master.php.net/note/reject/116673
Search -- https://master.php.net/manage/user-notes.php