Re: Should PQconsumeInput/PQisBusy be expensive to use?

From: David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>
To: Michael Clark <codingninja(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Should PQconsumeInput/PQisBusy be expensive to use?
Date: 2010-10-27 21:31:59
Message-ID: AANLkTikNS5XAEYf_eAc-xcfyW0rw33xfZ4G-TsppHDXn@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 27, 2010 at 5:02 PM, Michael Clark <codingninja(at)gmail(dot)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(dot)t(dot)wilson(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-10-27 22:10:54 Re: Should PQconsumeInput/PQisBusy be expensive to use?
Previous Message Alex Hunsaker 2010-10-27 21:30:43 Re: Should PQconsumeInput/PQisBusy be expensive to use?