Re: async queries in Perl and poll()/select() loop - how to make them work together? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: async queries in Perl and poll()/select() loop - how to make them work together?
Date
Msg-id AANLkTikT=EC+0whYXH_VG4iLna9BF22cYcn=gLbF2Eab@mail.gmail.com
Whole thread Raw
In response to Re: async queries in Perl and poll()/select() loop - how to make them work together?  (Andy Colson <andy@squeakycode.net>)
List pgsql-general
On Mon, Nov 1, 2010 at 1:31 PM, Andy Colson <andy@squeakycode.net> wrote:
> I dont think you can start a second query until you have called
> $dbh->pg_result.  These constants just give you neat ways of waiting... its
> still just one at a time.

Correct.  The C api also supports the ability to test if getting the
result would 'block'...meaning wait for the server generated result
because the client doesn't have it yet.

Asynchronous queries give you a neat way to wait on the server or do a
bit of work while a previous query is executing without dealing with
the headache of threads.  You can't overlap queries on a single
connection because the server doesn't support it.  You could however
create (a very small number of, like 2) multiple connections, keep
them open, and round robin them.  Forking is overkill.

merlin

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Replication
Next
From: Thomas Kellerer
Date:
Subject: Re: Replication