|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: turneliusz at gmail dot com
New email:
PHP Version: OS:


 [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-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 00:03:41 2021 UTC