Bug #68548 [Com]: slow calls to mysqli_fetch_field when using MYSQLI_STORE_RESULT_COPY_DATA

From: Date: Tue, 31 May 2016 20:38:11 +0000
Subject: Bug #68548 [Com]: 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-201374@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
 Comment by:         notvalid at gmail dot com
 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
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Linux
 PHP Version:        5.6.3
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#201374) next »