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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 14:01:30 2024 UTC