ID: 30194 User updated by: phoeniks2k at mail dot ru Reported By: phoeniks2k at mail dot ru -Status: Feedback +Status: Open Bug Type: MySQLi related Operating System: All PHP Version: 5.0.1 New Comment:
<?php function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((double)$usec + (double)$sec); } $host = 'localhost'; $login = 'parallax'; $password = 'parallax'; $db_name = 'parallax_kernel'; $link = mysqli_init(); mysqli_real_connect($link, $host, $login, $password, $db_name); $st = mysqli_prepare($link, "SELECT id, title, proto, lnk4, mdf, xml FROM objects_hier oh WHERE owner = ?"); $info = array(); $owner = 0; mysqli_stmt_bind_param($st, 'i', $owner); /*---------------------------------------------------------*/ $t = getmicrotime(); for ($owner = 0; $owner < 20; $owner++) { mysqli_stmt_execute($st); mysqli_stmt_bind_result($st, $info['id'], $info['title'], $info['proto'], $info['lnk4'], $info['mdf'], $info['xml']); while (mysqli_fetch($st)) { // some data manipulations that are equiv. those in query } mysqli_stmt_free_result($st); } echo (getmicrotime() - $t).'<br>'; /*--------------------------------------------------------*/ $t = getmicrotime(); for ($owner = 0; $owner < 20; $owner++) { $recordset = mysqli_query($link, "SELECT id, title, proto, lnk4, mdf, xml FROM objects_hier oh WHERE owner = $owner"); while ($row = mysqli_fetch_assoc($recordset)) { // some data manipulations that are equiv. those in stmt } mysqli_free_result($recordset); } echo (getmicrotime() - $t).'<br>'; ?> Previous Comments: ------------------------------------------------------------------------ [2004-09-29 12:10:42] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. Please read the comments more carefully. As I mentioned before, add a short reproducible testcase. ------------------------------------------------------------------------ [2004-09-29 11:50:23] phoeniks2k at mail dot ru In another words reading clobs from statement results looks much slower then reading those from simple select results ------------------------------------------------------------------------ [2004-09-29 11:44:16] phoeniks2k at mail dot ru No, i ment another thing. Every query\stmt is executed multiple times (stmts are prepared only once) This statement SELECT id, title, proto, lnk4, mdf FROM objects_hier oh WHERE owner = ? works FASTER then query SELECT id, title, proto, lnk4, mdf FROM objects_hier WHERE owner = $owner_id But this statement (i marked clob field) SELECT id, title, proto, lnk4, mdf, xml_data <<<(clob) FROM objects_hier oh WHERE owner = ? works MUCH SLOWER then query SELECT id, title, proto, lnk4, mdf, xml_data <<<(clob) FROM objects_hier WHERE owner = $owner_id Every time ALL DATA is fetched from recordsets to script variables, everything is made as it was described in DOC and is identical by result except exec time ------------------------------------------------------------------------ [2004-09-29 11:16:07] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Retrieving only a single recordset with a prepared statement is of course slower. Why do you use mysqli_stmt_store_result? The first recordset is already sent to client after mysqli_stmt_execute. Also there is no reproducible testcase in your bug report. ------------------------------------------------------------------------ [2004-09-22 14:38:07] phoeniks2k at mail dot ru Sorry, some additional info: Mysql 4.1.4 Gamma and clobs are not empty ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/30194 -- Edit this bug report at http://bugs.php.net/?id=30194&edit=1