Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-05 Thread Alexandros Efentakis
To answer my own question, I adapted http://stackoverflow.com/questions/16128142/how-to-use-pqxxstateless-cursor-class-from-libpqxx try { work W(*Conn); pqxx::stateless_cursor cursor(W, sql[sqlLoad], "mycursor", false); /* Assume you know

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-05 Thread Alexandros Efentakis
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://stackoverf

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-04 Thread alexandros_e
To answer my own question, I adapted How to use pqxx::stateless_cursor class from libpqxx? try { work W(*Conn); pqxx::stateless_cursor cursor(W, sql[sqlLoad], "mycursor", false); /* Assume you know total number of records returned */ for (size_t idx

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-04 Thread Tom Lane
Andres Freund writes: > On 2014-05-04 01:57:43 -0700, alexandros_e wrote: >> 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 wor

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-04 Thread Andres Freund
Hi, On 2014-05-04 01:57:43 -0700, alexandros_e wrote: > 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

Re: [GENERAL] C++, Postgres , libpqxx huge query

2014-05-04 Thread Alban Hertroys
On 04 May 2014, at 10:57, alexandros_e wrote: > Hello experts. I have posted this question on stack overflow, but I did not > get any detailed answer, so I thought I should cross post here. My > apologies. > > I have to execute an SQL query to Postgres by the following code. The query > returns

[GENERAL] C++, Postgres , libpqxx huge query

2014-05-04 Thread alexandros_e
Hello experts. I have posted this question on stack overflow, but I did not get any detailed answer, so I thought I should cross post here. My apologies. 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