Re: Should PQconsumeInput/PQisBusy be expensive to use?

Поиск
Список
Период
Сортировка
От A.M.
Тема Re: Should PQconsumeInput/PQisBusy be expensive to use?
Дата
Msg-id E8AF830B-6B5F-4B85-B39B-D06F20869488@themactionfaction.com
обсуждение исходный текст
Ответ на Re: Should PQconsumeInput/PQisBusy be expensive to use?  (Michael Clark <codingninja@gmail.com>)
Ответы Re: Should PQconsumeInput/PQisBusy be expensive to use?  (Michael Clark <codingninja@gmail.com>)
Re: Should PQconsumeInput/PQisBusy be expensive to use?  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-general
On Oct 28, 2010, at 11:08 AM, Michael Clark wrote:

> Hello all.
>
> Thanks a lot for the responses, they are appreciated.
>
> I think I now understand the folly of my loop, and how that was negatively
> impacting my "test".
>
> I tried the suggestion Alex and Tom made to change my loop with a select()
> and my results are now very close to the non-async version.
>
> The main reason for looking at this API is not to support async in our
> applications, that is being achieved architecturally in a PG agnostic way.
> It is to give our PG agnostic layer the ability to cancel queries.
> (Admittedly the queries I mention in these emails are not candidates for
> cancelling...).

Hm- I'm not sure how the async API will allow you to cancel queries. In PostgreSQL, query canceling is implemented by
openinga second connection and passing specific data which is received from the first connection (effectively sending a
cancelsignal to the connection instead of a specific query). This implementation is necessitated by the fact that the
PostgreSQLbackend isn't asynchronous. 

Even if you cancel the query, you still need to consume the socket input. Query cancellation is available for libpq
bothin sync and async modes. 

Cheers,
M

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

Предыдущее
От: Michael Clark
Дата:
Сообщение: Re: Should PQconsumeInput/PQisBusy be expensive to use?
Следующее
От: Michael Clark
Дата:
Сообщение: Re: Should PQconsumeInput/PQisBusy be expensive to use?