title: Streaming libpq results from PQexec
body: <p>In attempting to download a large batch of data from Postgres 9.3 in C via libpq's <code>PQexec</code>, I'm wondering if there's a way to stream the result set from the server. From watching top, I can see my memory utilization increasing by roughly the expected result set size when I call <code>PQexec</code>. I want to iterate over the results and "throw away" the results after I've processed them to keep the memory utilization on the processing node down. I couldn't find any mention of such behavior in the <a href="http://www.postgresql.org/docs/9.1/static/libpq-exec.html" rel="nofollow">docs</a>. Something like psycopg2's <a href="http://initd.org/psycopg/docs/cursor.html#cursor.fetchmany" rel="nofollow">fetchmany</a> would be ideal. </p>
  
  <p>Is the only way to "stream" results from libpq by rewriting the query to run in batches? </p>