From: Jeroen T. Vermeulen <jtv@xs4all.nl>
To: jing han <jing_han_66@yahoo.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: about libpq-C FETCH ALL performance issue
Date: Mon, 15 Nov 2004 15:24:52 +0100
Message-ID: <20041115142452.GF90696@xs4all.nl> (raw)
In-Reply-To: <20041115135501.51510.qmail@web53507.mail.yahoo.com>
References: <20041115135501.51510.qmail@web53507.mail.yahoo.com>
On Mon, Nov 15, 2004 at 05:55:01AM -0800, jing han wrote:
> and then res = PQexec(conn, "FETCH ALL in myportal");
>
> to get the data.
>
> I found when our database has more and more data, res
> = PQexec(conn, "FETCH ALL in myportal"); cost more and
> more time, much more than
If you use just the FETCH ALL, why are you using a cursor in the first
place?
> Then I try FETCH 1 instead of FETCH ALL, no
> improvement.
Are you doing just one FETCH 1 to obtain a single row, or are you
doing the FETCH 1 in a loop so you get all rows? The latter would
be extremely slow in any case... Try fetching smaller blocks, like
maybe 100 rows at a time, and see if that helps.
> I wonder if there is other faster way ( I mean other
> than FETCH ALL command) to get data from database with
> libpq-C, or If you have a patch to make FETCH work
> faster or new release to work better?
Just do a normal "SELECT" without the cursor. This will give you
all the data at once, just like a FETCH ALL.
Jeroen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: jtv@xs4all.nl, jing_han_66@yahoo.com
Subject: Re: about libpq-C FETCH ALL performance issue
In-Reply-To: <20041115142452.GF90696@xs4all.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox