Re: rfc - libpq extensions

From: Iker Arizmendi <iker(at)research(dot)att(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: rfc - libpq extensions
Date: 2003-01-10 20:16:23
Message-ID: 20030110151623.45dafd8b.iker@research.att.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 10 Jan 2003 18:37:52 +0100
Csaba Nagy <nagy(at)domeus(dot)de> wrote:

> AFAIK Using the same connection to do more queries at the same time is
> not supported by the backend.
> If you use transactions, it will only make your life harder to make
> sure the transaction goes on on the same connection, and nobody else
> uses the same connection meanwhile, messing with your ongoing
> transaction... unless the postgres developers would be willing to
> implement connection independent transactions (by the means of a
> transaction ID passed along with the query ? this is DB sience fiction
> - might be good but it's not standard nor really needed).
>

By using something like virtual (or "soft") connections (see my
previous post) it's relatively straight forward to make sure that
several queries that form a single transaction get the same DB
connection. Once a transaction is started on a virtual connection
and the VC gets a hold of a database connection it can
simply hold on to it until the transaction is finalized. If another
virtual connection is waiting for a DB connection it will just
queue its queries and wait for one to become available. Once it gets
it, it will hold it for the duration of one query (for non TX queries)
or several queries (eg, "BEGIN", "INSERT..", "UPDATE..", "COMMIT").

> I assume your problems with connection pooling are the relatively big
> setup time of a connection, and the possibility of running out of
> connections...

I think the more pressing problem for the connection-pooled,
event-driven server is that it cannot block to wait for a connection
(for whatever reason). At the same time it's pretty cumbersome for an
application developer to have to manually queue queries during the
wait.

Regards,
Iker

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hunter Hillegas 2003-01-10 20:35:37 Calculating Differences Between Dates - Problem
Previous Message scott.marlowe 2003-01-10 19:53:16 Re: persistant transactions