From: Kevin Brown <blargity@gmail.com>
To: Florian G. Pflug <fgp@phlo.org>
Cc: pgsql-general@postgresql.org
Subject: Re: Transactions
Date: Sat, 18 Mar 2006 13:16:34 -0600
Message-ID: <200603181316.35089.blargity@gmail.com> (raw)
In-Reply-To: <441C5861.9080005@phlo.org>
References: <200603180020.01418.blargity@gmail.com>
<200603181258.04019.blargity@gmail.com>
<441C5861.9080005@phlo.org>
On Saturday 18 March 2006 12:58, Florian G. Pflug wrote:
> Kevin Brown wrote:
> > So what you're saying is that my commits and rollbacks should be async,
> > correct?
>
> No, you should always use _async(), and never, ever use query() or exec()
> in a multi-threaded app.
>
> > I don't quite understand how a select can be an async call.... I need
> > the data to proceed. If you're saying on my inserts, deletes, etc, then
> > that I can understand.
>
> Don't be fooled by the word async()... It's still synchronous for the
> thread that calls it - the _thread_ is blocked until the query is done,
> and query_async() returns the result, just as query() does. The difference
> is only for all _other_ threads. All other threads can continue to run
> while the one thread waits for query results _only_ if the one thread
> used query_async(). If it used query(), then you _whole_ interpreter is
> blocked until the query is finished.
OH. Thank you! :-)
> The naming of these function is quite strange - I was fooled by this
> myself, and so was whoever wrote the DBD-module for pg, because he used the
> non-async functions too ;-)
Yeah, I only want the thread to wait, and async sounds like asynchronous or
something. :-)
> To rephrase - you don't usually need to change anything in your program
> when using query_async() instead of query(). It'll just work better ;-).
Makes sense now.
> greetings, Florian Pflug
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-general@postgresql.org
Cc: blargity@gmail.com, fgp@phlo.org
Subject: Re: Transactions
In-Reply-To: <200603181316.35089.blargity@gmail.com>
References: <200603180020.01418.blargity@gmail.com> <200603181258.04019.blargity@gmail.com> <441C5861.9080005@phlo.org> <200603181316.35089.blargity@gmail.com>
* 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