#39308 [Opn->Bgs]: PDO eats 1 megabyte for every prepared statement for LONGTEXT fields
| From: | iliaa@php.net | Date: | Fri, 03 Nov 2006 13:41:58 +0000 |
| Subject: | #39308 [Opn->Bgs]: PDO eats 1 megabyte for every prepared statement for LONGTEXT fields | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104318@lists.php.net to get a copy of this message | ||
ID: 39308
Updated by: iliaa@php.net
Reported By: suhachov at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Performance problem
Operating System: Linux FC
PHP Version: 5.1.6
New Comment:
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
This is the only way we can bypass limitations of the MySQL's
prepared statement interface. If you disable native prepared
statements this problem will go away.
Previous Comments:
------------------------------------------------------------------------
[2006-10-30 15:02:02] suhachov at gmail dot com
Description:
------------
Simple program:
// remember used memory
$start = memory_get_usage();
$dbh = new PDO('mysql:...','...','...');
// create empty table
$dbh->query('DROP TABLE IF EXISTS ttt;');
$dbh->query("CREATE TABLE ttt ( id integer, args longtext);");
// simple code
function doQuery($id)
{
static $sth;
if( !$sth )
$sth = $GLOBALS['dbh']->prepare("SELECT * FROM ttt WHERE id = ?");
$sth->execute(array($id));
return $sth->fetchAll();
}
var_dump(doQuery('5'));
echo memory_get_usage()-$start;
// eats 1 megabyte of memory.
// if I duplicate doQuery()->doQuery2()
// and call doQuery2() - it eats 2(!!) Mb of memory
// if I remove LONGTEXT, everything is OK.
Reproduce code:
---------------
see above.
Expected result:
----------------
Please, not so much memory!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39308&edit=1