Thanks John for your answer. The problem is how do I declare the cursor and fetch through C++ and libpq++? And if I fetch 1000 rows at a time, then how do I handle that when I reach the end and there are less than 1000 rows available? Or I need to fetch one row at a time like this http://stackoverflow.com/questions/16128142/how-to-use-pqxxstateless-cursor-class-from-libpqxx?
A.
2014-05-04 12:11 GMT+03:00 John R Pierce <pierce@xxxxxxxxxxxx>:
On 5/4/2014 1:57 AM, alexandros_e wrote:see DECLARE and FETCH.
I have to execute an SQL query to Postgres by the following code. The query
returns a huge number of rows (40M or more) and has 4 integer fields: When I
use a workstation with 32Gb everything works but on a 16Gb workstation the
query is very slow (due to swapping I guess). Is there any way to tell the
C++ to load rows at batches, without waiting the entire dataset? With Java I
never had these issues before, due to the probably better JDBC driver.
http://www.postgresql.org/docs/current/static/sql-declare.html
http://www.postgresql.org/docs/current/static/sql-fetch.html
--
john r pierce 37N 122W
somewhere on the middle of the left coast