|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69938 mysqlnd 50% slower to fetch all results than mysqli
Submitted: 2015-06-26 09:40 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: turneliusz at gmail dot com Assigned:
Status: Open Package: PDO MySQL
PHP Version: 5.6.10 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-06-26 09:40 UTC] turneliusz at gmail dot com
I'm just switching to mysqlnd to be able to use but I see some serious performance degradation compared to libmysql. That degradation is not documented and PHP documentation states that mysqlnd is dropped in replacement when in fact.

NewRewlic for my application shows more 100ms spend in PHP after switching to mysqlnd

I've created a benchmark to reproduce to problem, it's quite simple (ignore the fact I'm creating prepared statement in every iteration; it's just for testing only):

Orders table contains 91 columns.

$dbh = new PDO("mysql:host=$host; dbname=$dbname;", $user, $pass);

for ($i = 0; $i < 1000; $i++) {
    $sth = $dbh->prepare("SELECT * FROM Orders LIMIT 100");

    $result = $sth->fetchAll(PDO::FETCH_ASSOC);

Execution time:
libmysql - 2 seconds
mysqlnd - 3 seconds (50% more)


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 15:05:53 2022 UTC