Dear NG,
I have a serious performance flaw, when using postgresql 8.1 (other
versions haven't been tested) with libpq. When executing a
select * from "xyz" 1)
and "xyz" contains 300'000 records, it takes more than 60 seconds for
the query just to complete. First I thought it is a performance problem
of the server, but then we noticed an enormous amount of TCP/IP packets
that are beeing received in that (waiting)time. The memory usage of my
process, while waiting for the query to complete, bumps up to more than
300MB, the CPU usage goes up to 100%! It seems as if libpq would be
receiving the complete resultset from the server _before_ returning from
the query execution! (Even then 300MB seems for me to be too much, but
that's not the point!) Just to ensure: I didn't perform ANY _fetch_ so
far! It's just about executing the query.
Does anybody have any idea, what's going on here?
When doing the query in pgAdmin III it also takes that awful long time
and pgAdmin III memory usage also goes up to over 300 MB. We specified
in pgAdmin III to fetch only 1 row, thus _filling_ the grid cannot be
the reason there. The query there took 115 seconds just to complete. :-(
Can anybody help me out?!? I'd appreciate even just a hint or reference
to somewhere else. We already googled "memory and libpq" but the first
200 hits (sigh) didn't give any useful hint in that respect...
Thanx in advance,
Alexander
PS:
1) Remark: yes, this SELECT * query is neccessary and cannot be further
restricted by a where. The query retrieves ALL records of a specific
table (e.g. invoices) to be watched on the screen by a user. Of course
only data of the currently visible records in the grid are being fetched.