|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66558 MYSQL_ATTR_USE_BUFFERED_QUERY = true doesn't work as expected ?
Submitted: 2014-01-23 09:25 UTC Modified: 2020-12-09 15:51 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: netmosfera at email dot it Assigned:
Status: Not a bug Package: PDO MySQL
PHP Version: 5.5.8 OS:
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: netmosfera at email dot it
New email:
PHP Version: OS:


 [2014-01-23 09:25 UTC] netmosfera at email dot it
Hello, I'm not entirely sure that this is a bug or the expected behavior but seems that MYSQL_ATTR_USE_BUFFERED_QUERY is meant to store the whole recordset in memory, but what it actually seems to do is buffering just the first record of a resultset, while I was expecting it to use about the same memory of fetchAll()

It is advertised as "alternative" to fetchAll in but again what it seems to do is to work exactly like unbuffered queries, except for the fact that the first record is pre-fetched before the first $stmt->fetch() call.

So, take a look at it! if this is the expected behavior I think it should be at least documented somehow!

Thank you :)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-24 08:13 UTC] netmosfera at email dot it
it was told me that it works like it should, but i can't notice the memory incrementing because the memory is handled internally by mysql and not by php.

then if it is buffered, why not implementing something like an emulated cursor? something like data_seek() in mysqli?

this should probably be closed as invalid, or consider it a feature request

 [2014-03-06 14:25 UTC] narf at devilix dot net
Does PDOStatement::rowCount() return the proper number of rows? If so, then everything is fine ... you don't need to bother measuring memory usage.
 [2020-12-09 15:51 UTC]
-Status: Open +Status: Not a bug
 [2020-12-09 15:51 UTC]
Per above comments there doesn't seem to be a bug here, mysqlnd simply didn't use ZMM at the time, so memory usage was not visible.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 15:01:31 2024 UTC