Skip site navigation (1) Skip section navigation (2)

Re: BUG #1756: PQexec eats huge amounts of memory

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Denis Vlasenko <vda(at)ilport(dot)com(dot)ua>
Cc: John R Pierce <pierce(at)hogranch(dot)com>,Neil Conway <neilc(at)samurai(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1756: PQexec eats huge amounts of memory
Date: 2005-07-11 00:38:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
On Sun, Jul 10, 2005 at 01:05:10PM +0300, Denis Vlasenko wrote:
> On Thursday 07 July 2005 20:43, Alvaro Herrera wrote:

> > Really?  I thought what really happened is you had to get the results
> > one at a time using the pg_fetch family of functions.  If that is true,
> > then it's possible to make the driver fake having the whole table by
> > using a cursor.  (Even if PHP doesn't do it, it's possible for OCI to do
> > it behind the scenes.)
> Even without cursor, result can be read incrementally.
> I mean, query result is transferred over network, right?
> We just can stop read()'ing before we reached the end of result set,
> and continue at pg_fetch as needed.

It's not that simple.  libpq is designed to read whole result sets at a
time; there's no support for reading incrementally from the server.
Other problem is that neither libpq nor the server know how many tuples
the query will return, until the whole query is executed.  Thus,
pg_numrows (for example) wouldn't work at all, which is a showstopper
for many PHP scripts.

In short, it can be made to work, but it's not as simple as you put it.

Alvaro Herrera (<alvherre[a]>)
"Industry suffers from the managerial dogma that for the sake of stability
and continuity, the company should be independent of the competence of
individual employees."                                      (E. Dijkstra)

In response to


pgsql-bugs by date

Next:From: Oliver JowettDate: 2005-07-11 02:29:37
Subject: Re: BUG #1756: PQexec eats huge amounts of memory
Previous:From: Sivaraman K.GDate: 2005-07-10 18:28:27
Subject: Re: [BUGS] BUG #1745: Unable to delete data from the database

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group