Re: C++, Postgres , libpqxx huge query

From: Alexandros Efentakis <efentakis(at)imis(dot)athena-innovation(dot)gr>
To: John R Pierce <pierce(at)hogranch(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: C++, Postgres , libpqxx huge query
Date: 2014-05-04 09:48:50
Message-ID: CAALHc0WpMwHt9_9+xF+D6P9Qokk2QOBWgYm1giX019MaH=-FNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)hogranch(dot)com>:

> On 5/4/2014 1:57 AM, 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 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.
>>
>
> see DECLARE and FETCH.
>
> 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
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2014-05-04 09:59:06 Re: C++, Postgres , libpqxx huge query
Previous Message alexandros_e 2014-05-04 08:57:43 C++, Postgres , libpqxx huge query