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

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: So, is COUNT(*) fast now?
Дата
Msg-id CAMkU=1wuG21nsLNSqutrawR3M2ffU70SX5KXdCD2gWU=s81vOw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: So, is COUNT(*) fast now?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: So, is COUNT(*) fast now?
Список pgsql-hackers
On Fri, Oct 21, 2011 at 12:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Oct 21, 2011 at 2:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I think HeapTupleSatisfiesMVCC is probably being skipped anyway in
>>> this case, since all the heap pages should be PD_ALL_VISIBLE.
>>
>> Proves my point ;-) ... you're comparing a code path that's been beat on
>> for *years* with one that just got written.
>
> I know.  I wrote a chunk of it.  :-)  My point is just that it'd be
> nice to make it better.
>
> Anyhow, here's the scoop.  On my desktop machine running F14, running
> SELECT sum(1) FROM pgbench_accounts in a tight loop, 60 s worth of
> oprofile data:
>
> 176830   13.0801  postgres                 postgres                 ExecProject

Hi Robert,

count(*) and sum(1) do different things internally, and in my hands
sum(1) is ~10% slower.

I don't know how to dump the output of ExecBuildProjectionInfo into a
human readable form, so I don't know the basis of the difference.  But
I wonder if using count(*) would lower the weight of the ExecProject
function.


Cheers,

Jeff


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: termination of backend waiting for sync rep generates a junk log message
Следующее
От: Daniel Farina
Дата:
Сообщение: Re: Hot Backup with rsync fails at pg_clog if under load