Re: Transactions

Поиск
Список
Период
Сортировка
От Kevin Brown
Тема Re: Transactions
Дата
Msg-id 200603181316.35089.blargity@gmail.com
обсуждение исходный текст
Ответ на Re: Transactions  ("Florian G. Pflug" <fgp@phlo.org>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Florian G. Pflug"
Дата:
Сообщение: Re: Transactions
Следующее
От: "Hrishikesh Deshmukh"
Дата:
Сообщение: Re: OpenSuse10.0 and postgresql