Maciek Sakrejda wrote:
>> So my question is: is there any particularly low-overhead statement that
>> might be suitable for generating pointless client/server chat to check for
>> received async notifications? Should I just use "SELECT 1" ? Or would I be
>> better off using a SHOW statement like "SHOW role" to avoid creating a
>> snapshot etc?
> Does the jdbc driver work with EmptyQueryResponse?
It seems to.
> At the protocol
> level, if you send a Query message with an all-whitespace sql string,
> the backend is supposed to reply with a single EmptyQueryResponse
> message and then issue ReadyForQuery again. I have a feeling that jdbc
> is probably "too smart" for this to work, but it could be worth a
The JDBC driver isn't too smart for this - it doesn't catch the empty
query, but instead merrily passes it on to the backend as part of an
extended query request.
See the attached text file - it shows the client/server chat for one
such round trip.
So: the server doesn't consider the empty query an error, so it won't
affect any currently running transactions. It's a cheap single-message
each way round-trip, and it doesn't have any planning or snapshot
creation costs. Looks good to me :-)
Since I can't imagine an app _needing_ the JDBC driver to ignore empty
queries, is this something that it might be reasonable to document as
expected behavior from the driver - that it _will_ send even empty
queries to the server?
Thanks _VERY_ much for the tip. You've saved me and my logs quite a bit
of pain. It's not as good as client-side-only polling, but it's a whole
nicer than a full dummy statement, and I can easily do it only when an
SSL connection is detected.
Description: text/plain (1.6 KB)
In response to
pgsql-jdbc by date
|Next:||From: Oliver Jowett||Date: 2009-12-21 08:08:13|
|Subject: Re: Issue with the JDBC driver doing timezone conversions
|Previous:||From: Craig Ringer||Date: 2009-12-21 06:59:58|
|Subject: Re: Cheapest way to poll for notifications? & Driver improvement
question re SSL and notify|
pgsql-general by date
|Next:||From: Dave Page||Date: 2009-12-21 08:43:55|
|Subject: Re: PostgreSQL@FOSDEM 2010 - Call for talks|
|Previous:||From: Mihamina Rakotomandimby||Date: 2009-12-21 07:11:41|
|Subject: Re: Server Requirements|