php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39308 PDO eats 1 megabyte for every prepared statement for LONGTEXT fields
Submitted: 2006-10-30 15:02 UTC Modified: 2006-11-03 13:41 UTC
From: suhachov at gmail dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.1.6 OS: Linux FC
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: suhachov at gmail dot com
New email:
PHP Version: OS:

 

 [2006-10-30 15:02 UTC] 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!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-03 13:41 UTC] iliaa@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 19:01:37 2025 UTC