Re: Should PQconsumeInput/PQisBusy be expensive to use?

Поиск
Список
Период
Сортировка
От David Wilson
Тема Re: Should PQconsumeInput/PQisBusy be expensive to use?
Дата
Msg-id AANLkTikNS5XAEYf_eAc-xcfyW0rw33xfZ4G-TsppHDXn@mail.gmail.com
обсуждение исходный текст
Ответ на Should PQconsumeInput/PQisBusy be expensive to use?  (Michael Clark <codingninja@gmail.com>)
Список pgsql-general


On Wed, Oct 27, 2010 at 5:02 PM, Michael Clark <codingninja@gmail.com> wrote:

    while ( ((consume_result = PQconsumeInput(self.db)) == 1) && ((is_busy_result = PQisBusy(self.db)) == 1) )
        ;
    

The problem with this code is that it's effectively useless as a test. You're just spinning in a loop; if you don't have anything else to be doing while waiting for responses, then this sort of calling pattern is always going to be worse than just blocking.

Only do async if you actually have an async problem, and only do a performance test on it if you're actually doing a real async test, otherwise the results are fairly useless.

--
- David T. Wilson
david.t.wilson@gmail.com

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

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