Bug #68548 [Opn->Fbk]: slow calls to mysqli_fetch_field when using MYSQLI_STORE_RESULT_COPY_DATA
| From: | cmb@php.net | Date: | Mon, 09 Mar 2020 17:56:52 +0000 |
| Subject: | Bug #68548 [Opn->Fbk]: slow calls to mysqli_fetch_field when using MYSQLI_STORE_RESULT_COPY_DATA | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225984@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68548&edit=1
ID: 68548
Updated by: cmb@php.net
Reported by: ryan dot brothers at gmail dot com
Summary: slow calls to mysqli_fetch_field when using
MYSQLI_STORE_RESULT_COPY_DATA
-Status: Open
+Status: Feedback
Type: Bug
Package: MySQLi related
Operating System: Linux
PHP Version: 5.6.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The other bug has been fixed, so I wonder whether that resolved
this issue as well.
Previous Comments:
------------------------------------------------------------------------
[2019-02-11 02:32:36] 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.
------------------------------------------------------------------------
[2016-05-31 20:38:08] 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.
------------------------------------------------------------------------
[2014-12-05 04:15:40] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68548&edit=1