Re: Extended Query, flush or sync ?

From: Raimon Fernandez <coder(at)montx(dot)com>
To: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Cc: John DeSoi <desoi(at)pgedit(dot)com>
Subject: Re: Extended Query, flush or sync ?
Date: 2009-12-19 07:40:12
Message-ID: A321ADD5-6C0F-46F5-87EA-EAEBA6420442@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Hello,

On 19/12/2009, at 4:31, John DeSoi wrote:

>
> On Dec 18, 2009, at 4:44 PM, Raimon Fernandez wrote:
>
>> It's not clear for me if I have to issue a flush or sync after each process of an extended query.
>>
>> It's almost working for me only when I send a sync, but not when I send a flush. With the flush, the connection seems freezed, or at least, I don't get any data from postgre.
>>
>>
>> - Send the parse command
>> - sync
>> - Receive the ParseComplete
>> -sync
>> - Send the Bind
>> - sync
>> - Receive the BincComplete
>> - send the Execute
>> - receive an error => "portal xxxxxxx does not exist"
>
>
> I send:
>
> parse
> bind
> describe
> execute
> sync
>
> and then loop on the connection stream to receive the responses.

And do you get the parseComplete after sending the parse or after sending the sync ?

I'm not getting parseComplete, bindComplete if I don't send a sync after each command.

If I follow your advice, after the sync, I get the parseComplete, bincComplete, and portalSuspended (beacuse I've reach the max rows)

Don't know if your correct approach is the correct, but why send a Bind if we don't know if the parse has been successfully created ...

From the docs:

"A Flush must be sent after any extended-query command except Sync, if the frontend wishes to examine the results of that command before issuing more commands.
Without Flush, messages returned by the backend will be combined into the minimum possible number of packets to minimize network overhead."

Ok, I see that both approachs should work, but for me, sending a flush after each extended query command like parse, bind, ... doesn't do nothing ...

And also from the docs:

"If Execute terminates before completing the execution of a portal (due to reaching a nonzero result- row count), it will send a PortalSuspended message; t
he appearance of this message tells the frontend that another Execute should be issued against the same portal to complete the operation. "

If I execute with a row limit of 1000, and I know there are more than 1000 rows, I get the portalSuspended as described.

But, If a issue a new Execute, postgresql says that myPortal doesn't exist anymore.

How I can get those 1000 rows ?

thanks !

regards,

raimon

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2009-12-19 10:19:12 Re: Justifying a PG over MySQL approach to a project
Previous Message Craig Ringer 2009-12-19 07:24:53 Re: Cheapest way to poll for notifications?

Browse pgsql-interfaces by date

  From Date Subject
Next Message John DeSoi 2009-12-19 15:32:02 Re: Extended Query, flush or sync ?
Previous Message John DeSoi 2009-12-19 03:31:25 Re: Extended Query, flush or sync ?