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

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Andy Colson <andy(at)squeakycode(dot)net>
Cc: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: async queries in Perl and poll()/select() loop - how to make them work together?
Date: 2010-11-01 20:22:37
Message-ID: AANLkTikT=EC+0whYXH_VG4iLna9BF22cYcn=gLbF2Eab@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 1, 2010 at 1:31 PM, Andy Colson <andy(at)squeakycode(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2010-11-01 20:26:38 Re: Replication
Previous Message Scott Marlowe 2010-11-01 20:21:14 Re: Replication