|From:||Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>|
|To:||"Kirby Bohling (TRSi)" <kbohling(at)oasis(dot)novia(dot)net>|
|Subject:||Re: cursor interface to libpq|
|Views:||Raw Message | Whole Thread | Download mbox|
> I am trying to run a select statement, and I keep running out of
> memory. I have noticed that libpq has the nice feature that I don't have
> to request each row one at a time. After a little investigate, I found
> that libpq appears to get the entire result set at once. Well, at least
> PQgetvalue() doesn't appear to do anything besides return a pointer to a
> string. There is no lazy evaluation. It doesn't just fetch the row I
> need, and flush old ones as memory permits.
Use a cursor at the query level to keep the result set in the backend.
But you will still (possibly) run out of memory, since the *backend*
must keep the result set in memory and/or on disk. Make sure you have
enough swap space, disk space, and main memory to handle the size of
database you have.
> Is there any interface that I can link to a C/C++ program that
> will allow me row at a time access to the data? Not being able to run
> select statements is going to be a fairly sizeable problem for me.
Look at cursors, but that doesn't eliminate the need for enough memory.
Expect to buy more memory, and make sure you have enough swap space.
Send more details on what you have currently and what your database
looks like and we can give you better feedback on your resource
|Next Message||Tom Lane||2000-09-20 06:16:17||Re: cursor interface to libpq|
|Previous Message||Tom Samplonius||2000-09-20 04:20:59||Re: PHP & Large Object|