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

Tom Lane <[email protected]>
Newsgroups gmane.comp.db.postgresql.performance
Message-ID <[email protected]>
Thomas Kellerer <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.