Re: SELECT very slow - Mailing list pgsql-sql

From Volkan YAZICI
Subject Re: SELECT very slow
Date
Msg-id 7104a7370506090031c8617d3@mail.gmail.com
Whole thread Raw
In response to Re: SELECT very slow  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-sql
Hi,

On 6/9/05, Thomas Kellerer <spam_eater@gmx.net> wrote:
> No I want the whole result.

As Tom underlined:

On 6/9/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The solution is to use a cursor and FETCH a reasonably
> small number of rows at a time.

AFAIC, query results are stored as arrays in PGresult structures.
Thus, storing huge result sets in a single struct is not very
feasible; although, you can face with theoretical limits like MAX_INT
in the long run. Moreover, it's so rare to see any practical use of
retrieving thousands of rows. If you're getting quite huge sets of
data, you should try grouping them with suitable statements.

IMHO, you should use cursors to fetch a suitable amount of row from
related table and forward it recursively. (Furthermore, I think this
is one of the design goals of FETCH mechanism.)

Although, as I see from most API implementations (like C++, Perl, PHP,
Python and etc.), they use libpq as layer between API and server.
Therefore, you'll probably encounter with every limitation of libpq
with other programming languages out of C too.

Regards.


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Indices and user defined operators
Next
From: Thomas Kellerer
Date:
Subject: Re: SELECT very slow