php.net |  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: -
Votes:1
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: turneliusz at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-26 09:40 UTC] turneliusz at gmail dot com
Description:
------------
I'm just switching to mysqlnd to be able to use http://php.net/manual/en/book.mysqlnd-ms.php 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 https://db.tt/68r9RfhJ

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");
    $sth->execute();

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

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 04:01:23 2020 UTC