[php-src] PR #14260: ext/pdo_pgsql: Retrieve the memory usage of the query result resource
| From: | KentarouTakeda | Date: | Fri, 17 May 2024 13:48:55 +0000 |
| Subject: | [php-src] PR #14260: ext/pdo_pgsql: Retrieve the memory usage of the query result resource | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-26197@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14260
Author: KentarouTakeda
This implementation is similar to Pull Request #14214.
I have implemented the same functionality in
PDOStatement, specifically for
PdoPgsql.
By calling:
```php
$statement->getAttribute(PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE);
```
You can find out the amount of memory used internally by the client library libpq.
This value was not reflected in the memory_get_usage() output, so it was not possible
to determine until now.
PDOStatement differs from PgSql\Result in that it may represent a
statement that has not yet been executed.
In this case, libpq does not allocate memory either.Therefore,
PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE returns null in such cases.
Since this feature did not require an RFC for ext/pgsql, I am wondering if it is also
unnecessary for this implementation. Please let me know if an RFC is needed or if there are any
internals discussions required.