php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68548 slow calls to mysqli_fetch_field when using MYSQLI_STORE_RESULT_COPY_DATA
Submitted: 2014-12-05 04:15 UTC Modified: -
Votes:2
Avg. Score:2.5 ± 1.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: ryan dot brothers at gmail dot com Assigned:
Status: Open Package: MySQLi related
PHP Version: 5.6.3 OS: Linux
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: ryan dot brothers at gmail dot com
New email:
PHP Version: OS:

 

 [2014-12-05 04:15 UTC] ryan dot brothers at gmail dot com
Description:
------------
I am seeing an issue where calls to mysqli_fetch_field() are very slow when using MYSQLI_STORE_RESULT_COPY_DATA.

In the below example, the call to fetch_field takes 5 seconds to run.

If the below is changed to call store_result() without MYSQLI_STORE_RESULT_COPY_DATA, then the call to fetch_field takes 0.006 seconds to run.

Is there a way that the time to call fetch_field could be improved when using MYSQLI_STORE_RESULT_COPY_DATA?

I have placed SQL to create a test table of 100,000 rows at https://drive.google.com/uc?export=download&id=0B37DKbJklxg_Y3NadnRjc2tVbE0.

Thanks for your help.


Test script:
---------------
<?php
$mysqli = new mysqli('localhost', 'test', 'test', 'test');

$mysqli->real_query("SELECT * FROM a");

$result = $mysqli->store_result(MYSQLI_STORE_RESULT_COPY_DATA);

$start = microtime(true);

$field = $result->fetch_field();

echo microtime(true) - $start."\n";
exit;


Expected result:
----------------
0.0065169334411621

Actual result:
--------------
5.0267069339752

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-31 20:38 UTC] notvalid at gmail dot com
Also of note, CPU utilization is maxed out during the delay in returning the list of fields. On a result set with over 1m rows, MYSQLI_STORE_RESULT_COPY_DATA results in over a 30 minute call to fetch_fields() while disabling MYSQLI_STORE_RESULT_COPY_DATA returns data from fetch_fields() almost immediately.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Jul 17 11:01:54 2018 UTC