Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA02801; Thu, 25 Jul 91 10:56:40 -0700
Date: Thu, 25 Jul 91 10:56:40 -0700
From: ambdata%dpi.inpe.br@cmsa.Berkeley.EDU (Banco de Dados Ambiental)
Subject: faster fetch
To: postgres@postgres.berkeley.edu
To: postgres@postgres.berkeley.edu
Message-Id: <9107251405.AA00537@dpi.inpe.br>
X-Envelope-To: postgres@postgres.berkeley.edu

        We're loading data as attributes of some relations using LIBPQ calls
in a C++ program. Some "retrieve portal" queries are issued in order to decide w
   ether a new tuple should be appended or an existing one should be updated. Th
   e same portal is open at each "retrieve" operation and closed after a "fetch
   all...". The "fetch" operation seems to be very slow.
        Is there a more efficient way to use portals or something to faster the
   fetch operations involved?

        e.g: This program gets values from a file and append new tuple depend on
    it.


while(1)
{
        value = GET_NEXT_VALUE();

        if( value == FALSE) break;

        PQexec("retrieve portal dbportal (Table.id) where Table.x = value );

        PQexec("fetch all in dbportal");

        .
        .
        .

        if( no tuple )
                PQexec( "append Table(x=value,id = id+1 )");

        PQexec("close dbportal");
}

        We'd like to reuse the code previously compiled with a parameter variabl
   e indicating a new value, without recompiling the retrieve query.


        Thanks in advance for any help!
