Skip site navigation (1) Skip section navigation (2)

Re: about libpq-C FETCH ALL performance issue

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: jing han <jing_han_66(at)yahoo(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: about libpq-C FETCH ALL performance issue
Date: 2004-11-15 14:24:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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

> 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.


In response to

pgsql-interfaces by date

Next:From: L J BayukDate: 2004-11-16 01:36:49
Subject: Re: Where is src/interfaces/libpgtcl?
Previous:From: jing hanDate: 2004-11-15 13:55:01
Subject: about libpq-C FETCH ALL performance issue

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group