From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Radosław Smogura <rsmogura@softperience.eu>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: David Fetter <david@fetter.org>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: PG Hackers <pgsql-hackers@postgresql.org>
Cc: PostgreSQL JDBC List <pgsql-jdbc@postgresql.org>
Cc: robertmhaas@gmail.com
Subject: Re: [JDBC] Support for JDBC setQueryTimeout, et al.
Date: Fri, 15 Oct 2010 10:52:48 -0400
Message-ID: <20101015145248.GR26232@tamriel.snowman.net> (raw)
In-Reply-To: <20260.1287153534@sss.pgh.pa.us>
References: <88dcb3988805ede17af4a460ad251534@smogura-softworks.eu>
<20101012141439.GA29627@fetter.org>
<4CB43A4C0200002500036826@gw.wicourts.gov>
<20101012155531.GB29627@fetter.org>
<AANLkTi=m7tzv7RzCmqD6ARWm_QWbg90Jmd0uTkosiZo4@mail.gmail.com>
<528f31015d6bf68650646b9b4ba71a10@smogura-softworks.eu>
<AANLkTinFMPHaa1SH-uf7fqBTkVcMZYRpxqjaaYUKHEHA@mail.gmail.com>
<c17d0cbfea679088a106a9c9b573196c@smogura-softworks.eu>
<20101015142126.GQ26232@tamriel.snowman.net>
<20260.1287153534@sss.pgh.pa.us>
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> > errr, I don't believe RESET ALL touches cache'd plans and whatnot (which
> > is actually a problem I've run into in the past, because changing the
> > search_path also doesn't invalidate plans, and neither does set role, so
> > you end up with cache'd plans that try to hit things you don't have
> > permissions to any more :( ).
>
> Yeah, actually what you need is DISCARD ALL when reassigning a
> connection to another client. Anything less than that assumes the
> clients are cooperating closely, ie they *want* the same prepared
> statements etc.
That assumption is certainly something I feel we should consider a valid
and important use-case. I'd think a lot of the time your typical website
is going to be using a dedicated pooler for connections and a dedicated
database where having those queries cache'd would be good.
I recall seeing a module that even set things up so you feed it all the
queries that you're going to run and it plans them all out for you when
you start up the pooler. Been meaning to look into it more, but..
The whole problem with search_path and role is very frustrating. We've
taken to just hacking things to be dynamic SQL whenever it's
role-specific, but that's a really poor solution. I wonder if it would
be possible to have the function and prepare'd plan caches be key'd off
of the search_path and role too..? So if you change one of those you
end up having to re-plan it, but then that's also cached, etc..
> But even if you make that assumption, a pooler that
> isn't even capable of sending an ABORT between clients doesn't seem
> usable to me. For example, if a client loses its network connection
> mid-transaction, that failure will cascade to other clients if you
> don't have any ability to reset the database session before handing
> it to another client.
I agree, the pooler definitely needs to be able to handle those
situations or you'll be running into some serious problems down the
road.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 196B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: sfrost@snowman.net, tgl@sss.pgh.pa.us, rsmogura@softperience.eu, magnus@hagander.net, david@fetter.org, Kevin.Grittner@wicourts.gov, pgsql-hackers@postgresql.org, robertmhaas@gmail.com
Subject: Re: [JDBC] Support for JDBC setQueryTimeout, et al.
In-Reply-To: <20101015145248.GR26232@tamriel.snowman.net>
References: <88dcb3988805ede17af4a460ad251534@smogura-softworks.eu> <20101012141439.GA29627@fetter.org> <4CB43A4C0200002500036826@gw.wicourts.gov> <20101012155531.GB29627@fetter.org> <AANLkTi=m7tzv7RzCmqD6ARWm_QWbg90Jmd0uTkosiZo4@mail.gmail.com> <528f31015d6bf68650646b9b4ba71a10@smogura-softworks.eu> <AANLkTinFMPHaa1SH-uf7fqBTkVcMZYRpxqjaaYUKHEHA@mail.gmail.com> <c17d0cbfea679088a106a9c9b573196c@smogura-softworks.eu> <20101015142126.GQ26232@tamriel.snowman.net> <20260.1287153534@sss.pgh.pa.us> <20101015145248.GR26232@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox