D
D
DnAp2014-09-03 00:03:11
PostgreSQL
DnAp, 2014-09-03 00:03:11

How to read data from Postgres line by line without loading everything into memory?

I found that when I make a query to the database using the PQexec C function, immediately after its execution, a large amount of memory is allocated for the result of the query.
How would I do data reading without loading the entire result into memory, but working with each line in turn?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lolshto, 2014-09-03
@DnAp

cursor
www.postgresql.org/docs/9.2/static/plpgsql-cursors.html

S
s1dney, 2014-09-03
@s1dney

In general, yes, the above answered.
You can also advise not to do select * from

D
DnAp, 2014-09-03
@DnAp

Thank you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question