Re: So, is COUNT(*) fast now?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: So, is COUNT(*) fast now?
Date: 2011-10-28 18:51:28
Message-ID: CA+TgmoZv5-tjPfKf=40YQfvOUNuK7u+sNAie8rriZoXuXmcZeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 28, 2011 at 2:48 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> I also tried changing the BufferIsValid() tests in
>> visibilitymap_test() to use BufferIsInvalid() instead, with the sense
>> of the tests reversed (see attached vismap-test-invalid.patch).  Since
>> BufferIsInvalid() just checks for InvalidBuffer instead of also doing
>> the sanity checks, it's significantly cheaper.  This also reduced the
>> time to about 330 ms, so seems clearly worth doing.
>
> Hmm.  I wonder whether it wouldn't be better to get rid of the range
> checks in BufferIsValid, or better convert them into Asserts.  It seems
> less than intuitive that BufferIsValid and BufferIsInvalid aren't simple
> inverses.

Seems reasonable. It would break if anyone is using an out-of-range
buffer number in lieu of InvalidBuffer, but I doubt that anyone is.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-10-28 19:02:22 Re: ecpg-related build failure with make 3.82
Previous Message Tom Lane 2011-10-28 18:48:54 Re: So, is COUNT(*) fast now?