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: 2020-03-22 04:22 UTC
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: cmb (profile)
Status: No Feedback Package: MySQLi related
PHP Version: 5.6.3 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
 [2019-02-11 02:32 UTC] ryan dot brothers at gmail dot com
I just submitted bug 77597, where now in PHP 7.3.2, calling mysqli_fetch_field hangs the script completely.
 [2020-03-09 17:56 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-03-09 17:56 UTC] cmb@php.net
The other bug has been fixed, so I wonder whether that resolved
this issue as well.
 [2020-03-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Apr 10 06:01:23 2020 UTC