Re: Allow pooled connections to list all prepared queries

From: David Brown <dave(at)spoonguard(dot)org>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: PostgreSQL Global Development Group <pgsql-patches(at)postgresql(dot)org>, Charlie Peck <charliep(at)cs(dot)earlham(dot)edu>
Subject: Re: Allow pooled connections to list all prepared queries
Date: 2004-12-27 19:12:20
Message-ID: 20041227191220.GA19378@lan.spoonguard.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Mon, Dec 27, 2004 at 01:03:08PM -0500, Kris Jurka wrote:
>has not prepared. So I don't see why, simply because it's in a pool, that
>it forgets what's been prepared.

The connection (the open socket to Postgres) doesn't forget anything. If
you have multiple machines sharing a connection pool, though, there may not
be any guarantee that the same client-side connection object (in your
example, the proxy object) will always be associated with the same
underlying connection (the open socket to Postgres).

Multiple machines connecting through a single connection pooling server need
some way to communicate the state of a particular connection between
themselves ("state", in this case, being the list of prepared queries).
This information could be tracked by the connection pool, it could be
tracked by the clients and shared through some back channel, or it could
just be exposed via SQL (since Postgres already has it in a convenient
format).

The patch provides a way to inspect the list of prepared queries on a
connection, via SQL. It'd be up to the client to avoid this round-trip when
it isn't necessary (e.g. the single-server or single-process cases you've
mentioned, where keeping and sharing the list of prepared statements is
cheap).

At a bare minimum, it'd at least be convenient for humans to be able to
connect to a pool and look at what's been prepared. There was no way to do
this before.

- Dave

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-12-27 22:21:31 Re: Bgwriter behavior
Previous Message Kris Jurka 2004-12-27 18:03:08 Re: Allow pooled connections to list all prepared queries