Doc #52127 [NEW]: mysl_fetch_assoc is much slower than mysql_fetch_row

From: Date: Sat, 19 Jun 2010 16:13:25 +0000
Subject: Doc #52127 [NEW]: mysl_fetch_assoc is much slower than mysql_fetch_row
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4575@lists.php.net to get a copy of this message
From: Operating system: CentOS PHP version: 5.3.2 Package: *General Issues Bug Type: Documentation Problem Bug description:mysl_fetch_assoc is much slower than mysql_fetch_row Description: ------------ "Note: Performance An important thing to note is that using mysql_fetch_assoc() is not significantly slower than using mysql_fetch_row(), while it provides a significant added value. " I compared mysql_fetch_assoc() and mysql_fetch_row(). These results show that there is a huge difference between these functions. Times for fetching 90000 records (there are 42 columns): 1. mysql_fetch_assoc() + array 2.20659708977 [s]. 2. mysql_fetch_row + array 1.21593475342E-5 [s]. 3. mysql_fetch_row + list() 2.40802764893E-5 [s]. 4. mysql_fetch_row() + foreach() 4.19616699219E-5 [s]. 5. mysql_fetch_object() 5.91278076172E-5 [s]. Times for fetching 50 records (there are 42 columns): 1. mysql_fetch_assoc() + array 0.00150012969971 [s]. 2. mysql_fetch_row + array 1.09672546387E-5 [s]. 3. mysql_fetch_row + list() 2.78949737549E-5 [s]. 4. mysql_fetch_row() + foreach() 4.19616699219E-5 [s]. 5. mysql_fetch_object() 5.50746917725E-5 [s]. Times for fetching 1 record (there are 42 columns): 1. mysql_fetch_assoc() + array 0.000169038772583 [s]. 2. mysql_fetch_row + array 9.77516174316E-6 [s]. 3. mysql_fetch_row + list() 3.50475311279E-5 [s]. 4. mysql_fetch_row() + foreach() 4.91142272949E-5 [s]. 5. mysql_fetch_object() 6.29425048828E-5 [s]. Times for fetching 90000 records (there is 1 column): 1. mysql_fetch_assoc() + array 0.10712313652 [s]. 2. mysql_fetch_row + array 1.4066696167E-5 [s]. 3. mysql_fetch_row + list() 4.88758087158E-5 [s]. 4. mysql_fetch_row() + foreach() 6.98566436768E-5 [s]. 5. mysql_fetch_object() 8.98838043213E-5 [s]. Times for fetching records (there is 1 column): 1. mysql_fetch_assoc() + array 0.000155925750732 [s]. 2. mysql_fetch_row + array 1.09672546387E-5 [s]. 3. mysql_fetch_row + list() 4.29153442383E-5 [s]. 4. mysql_fetch_row() + foreach() 6.29425048828E-5 [s]. 5. mysql_fetch_object() 8.01086425781E-5 [s]. Times for fetching 1 records (there is 1 column): 1. mysql_fetch_assoc() + array 0.000102996826172 [s]. 2. mysql_fetch_row + array 1.31130218506E-5 [s]. 3. mysql_fetch_row + list() 4.29153442383E-5 [s]. 4. mysql_fetch_row() + foreach() 5.79357147217E-5 [s]. 5. mysql_fetch_object() 7.20024108887E-5 [s]. -- Edit bug report at http://bugs.php.net/bug.php?id=52127&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52127&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52127&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52127&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52127&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52127&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52127&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52127&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52127&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52127&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52127&r=support Expected behavior: http://bugs.php.net/fix.php?id=52127&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52127&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52127&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52127&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52127&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52127&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52127&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52127&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52127&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52127&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52127&r=mysqlcfg

« previous php.doc.bugs (#4575) next »