php8.5
Home/ Manual/ pgsql / functions/ pg_result_memory_size

pg_result_memory_size

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Returns the amount of memory allocated for a query result

Description

pg_result_memory_size(PgSql\Result $result): int

Returns the amount of memory, in bytes, allocated to the specified query result PgSql\Result instance. This value is the same amount that would be freed by pg_free_result().

Parameters

result

Result

Return Values

Returns the memory amount in bytes.

Examples

pg_result_memory_size() example

php
<?php
$db = pg_connect("dbname=users user=me");

$res = pg_query($db, 'SELECT 1');

$size = pg_result_memory_size($res);

var_dump($size);
?>

The above example will output something similar to:

output
int(3288)

See Also

Source: reference/pgsql/functions/pg-result-memory-size.xml · from the official PHP manual (php/doc-en)