Subject: faster fetch

From: [email-masked] (Banco de Dados Ambiental)
Date: Thu, 25 Jul 91 10:56:40 -0700

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!