From:
Operating system: CentOS 5.5
PHP version: 5.3.3
Package: PDO related
Bug Type: Bug
Bug description:Non-linear performance degradation on certain prepared SELECT
queries
Description:
------------
When retrieving results from prepared PDO statements against MySQL, we get
performance that diverges from expected by 10X or more on results as low as
10000
rows. This only occurs for 'SELECT ... WHERE Id IN ( .. )' queries.
The attached script provides two PDO prepared approaches ('row-prepared',
default,
and 'all-prepared') as well as a variety of control methods that use
non-prepared
PDO queries, straight MySQL, and prepared queries using MySQLi. Only PDO
with
prepared queries exhibits the problem.
If the query is broken up into chunks that return 1000 rows or less prior
to
execution, then combined afterwards in PHP, performance is as expected.
Test script:
---------------
You can get the sample script from:
http://www.smugmug.com/test/pdo-problem.php.gz
Expected result:
----------------
pdo-problem.php?type=row-prepared and pdo-problem.php?type=all-prepared
should
return in ~0.5s, like the other types (row, all, chunk, mysql, mysqli).
Actual result:
--------------
pdo-problem.php?type=row-prepared and pdo-problem.php?type=all-prepared
return in
~6s instead of ~0.5s
--
Edit bug report at http://bugs.php.net/bug.php?id=53458&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53458&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53458&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53458&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53458&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53458&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53458&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53458&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53458&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53458&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53458&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53458&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53458&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53458&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53458&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53458&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53458&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53458&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53458&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53458&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53458&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53458&r=mysqlcfg