pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPQresultMemorySize of ResultSet larger than expected
2+ messages / 2 participants
[nested] [flat]
* PQresultMemorySize of ResultSet larger than expected
@ 2022-03-10 14:09 Dominique Devienne <ddevienne@gmail.com>
2022-03-10 15:00 ` Re: PQresultMemorySize of ResultSet larger than expected Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Dominique Devienne @ 2022-03-10 14:09 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
I've instrumented by libpq code, to show the byte size of the result-set.
And I'm suprised that it's never smaller than 2,264 bytes, then the next
size I see is 3,288, etc... Even when receiving no rows at all, in fact.
I've trimmed-out the SQL, but these are all SELECT statements.
The output below is from Windows, if that matters.
The two larger ones at the bottom are fetching bytea blobs.
So, is this expected? I'm surprised 2KB+ is used to return no rows basically.
Where's the space going?
Is the reported space the same or similar to the actual bytes returned
on the wire?
Or they somehow add up local allocations client-side?
Any way to actually know how many bytes were returned on the wire?
I'm basically curious, and would appreciate pointers to better understand this.
Thanks, --DD
Running 1 test case...
...
`-> got 1 rows x 16 cols, 3,288 bytes (2.7 MB/s) in 1.159ms
...
`-> got 1 rows x 18 cols, 3,288 bytes (2.2 MB/s) in 1.417ms
...
`-> got 1 rows x 18 cols, 3,288 bytes (4.1 MB/s) in 0.771ms
...
`-> got 0 rows x 15 cols, 2,264 bytes (2.1 MB/s) in 1.041ms
...
`-> got 0 rows x 3 cols, 2,264 bytes (2.2 MB/s) in 0.991ms
...
`-> got 0 rows x 15 cols, 2,264 bytes (3.3 MB/s) in 0.662ms
...
`-> got 0 rows x 3 cols, 2,264 bytes (4.3 MB/s) in 0.503ms
...
`-> got 1 rows x 14 cols, 3,288 bytes (3.6 MB/s) in 0.863ms
...
`-> got 1 rows x 16 cols, 3,288 bytes (5.0 MB/s) in 0.623ms
...
`-> got 0 rows x 15 cols, 2,264 bytes (3.6 MB/s) in 0.602ms
...
`-> got 0 rows x 3 cols, 2,264 bytes (4.4 MB/s) in 0.494ms
...
`-> got 0 rows x 15 cols, 2,264 bytes (3.7 MB/s) in 0.591ms
...
`-> got 0 rows x 3 cols, 2,264 bytes (3.9 MB/s) in 0.548ms
...
`-> got 1 rows x 1 cols, 818,441 bytes (78.1 MB/s) in 9.996ms
...
`-> got 1 rows x 1 cols, 3,288 bytes (7.9 MB/s) in 0.396ms
...
`-> got 1 rows x 1 cols, 36,345 bytes (33.4 MB/s) in 1.038ms
*** No errors detected
*** tests_acme_foo in 2.926s (user: 0.219s) 38 MB
Press any key to continue . . .
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PQresultMemorySize of ResultSet larger than expected
2022-03-10 14:09 PQresultMemorySize of ResultSet larger than expected Dominique Devienne <ddevienne@gmail.com>
@ 2022-03-10 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2022-03-10 15:00 UTC (permalink / raw)
To: Dominique Devienne <ddevienne@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Dominique Devienne <ddevienne@gmail.com> writes:
> I've instrumented by libpq code, to show the byte size of the result-set.
> And I'm suprised that it's never smaller than 2,264 bytes, then the next
> size I see is 3,288, etc... Even when receiving no rows at all, in fact.
See PGRESULT_DATA_BLOCKSIZE and associated comments, starting about
line 90 in fe-exec.c. I don't recall whether there was any specific
motivation for PGRESULT_DATA_BLOCKSIZE to be 2K rather than some
other value; but it wouldn't do for it to be very small.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-03-10 15:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 14:09 PQresultMemorySize of ResultSet larger than expected Dominique Devienne <ddevienne@gmail.com>
2022-03-10 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox