Re: Slow count(*) again...

From: Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow count(*) again...
Date: 2010-10-13 10:41:52
Message-ID: 4CB58CF0.4020601@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

12.10.10 14:44, Craig Ringer написав(ла):
>
>> in the case where you are doing a count(*) where query and the where is
>> on an indexed column, could the search just look at the index + the
>> visibility mapping rather than doing an sequential search through the
>> table?
>
> Nope, because the visibility map, which is IIRC only one bit per page,
> doesn't record how many tuples there are on the page, or enough
> information about them to determine how many of them are visible to
> the current transaction*.
I'd say it can tell you that your may not recheck given tuple, can't it?
You still have to count all index tuples and recheck the ones that are
uncertain. Does it work in this way? This can help a lot for wide tuples
in table, but with narrow index and mostly read-only data.

Best regards, Vitalii Tymchyshyn

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2010-10-13 10:48:17 Re: wip: functions median and percentile
Previous Message Pavel Stehule 2010-10-13 10:36:59 Re: wip: functions median and percentile

Browse pgsql-performance by date

  From Date Subject
Next Message Vitalii Tymchyshyn 2010-10-13 10:54:19 Re: Slow count(*) again...
Previous Message Neil Whelchel 2010-10-13 10:16:11 Re: Slow count(*) again...