Re: Surprising benchmark count(1) vs. count(*)

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Surprising benchmark count(1) vs. count(*)
Дата
Msg-id
22758.1568902312@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Surprising benchmark count(1) vs. count(*) Thomas Kellerer <spam_eater@gmx.net>
Re: Surprising benchmark count(1) vs. count(*) Laurenz Albe <laurenz.albe@cybertec.at>
Re: Surprising benchmark count(1) vs. count(*) Thomas Kellerer <spam_eater@gmx.net>
Re: Surprising benchmark count(1) vs. count(*) Tom Lane <tgl@sss.pgh.pa.us>
Re: Surprising benchmark count(1) vs. count(*) Adam Brusselback <adambrusselback@gmail.com>
Re: Surprising benchmark count(1) vs. count(*) Tom Lane <tgl@sss.pgh.pa.us>
Thomas Kellerer  writes:
> Laurenz Albe schrieb am 19.09.2019 um 12:22:
>> "count(1)" has to check if 1 IS NULL for each row, because NULL
>> values are not counted.  "count(*)" doesn't have to do that.

> But 1 is a constant, why does it need to check it for each row? 

[ shrug... ]  There's no special optimization for that case.
And I can't say that it seems attractive to add one.

			regards, tom lane


В списке pgsql-performance по дате отправления
От: Thomas Kellerer
Дата:
От: Mariel Cherkassky
Дата:
FAQ