Re: Server->Client notification (without polling)?

From: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Server->Client notification (without polling)?
Date: 2006-09-21 13:49:18
Message-ID: 0001HW.C13864FE00BE8C31F0305530@news.individual.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

>> I read the manual again and now I understand that it's the libpq client
>> library which requires polling a function to retrieve the notifications
>> received from the server. Is there no way to tell the library "please
>> call me when a notification arrives"?
>
> No, because it's only a library, it doesn't have its own thread of
> control.

Just to learn something new:

Is this because the library implementor has chosen to do it this way or
because there is no way to spawn a thread from this library?

I'm just a poor Python scripting dilettant for whom threads and such things
are deep black voodoo, so please excuse me if this question is utterly
braindead. :-)

The reason why I am asking for notification without polling is that I would
like to use a shared PostgreSQL database for data exchange with other
applications, and the data exchange is likely to happen very intermittently,
i.e. the data from other applications it will typically arrive in large
batches, with long pauses (sometimes hours) in between. But I still want to
get the data as soon as it is available, to not let the end-users wait for
minutes.

> If you are so inclined you can set up your application's main loop to
> watch for input on the database connection's socket (along with whatever
> other event sources it watches) and then call the library to see what it
> was.

Thanks, that's exactly what the example for Psycopg2 does apparently.

Sincerely,

Wolfgang Keller

--
My email-address is correct.
Do NOT remove ".nospam" to reply.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Wolfgang Keller 2006-09-21 15:10:59 Re: Server->Client notification (without polling)?
Previous Message Tony Davis 2006-09-21 12:41:59 Instal 8.1.4 on XP Home