Re: Surprising benchmark count(1) vs. count(*) - Mailing list pgsql-performance

From Adam Brusselback
Subject Re: Surprising benchmark count(1) vs. count(*)
Date
Msg-id CAMjNa7ftSKUFp4SO07ctTqBsQ5s7TjA89UFe_j1LON82b-oN0A@mail.gmail.com
Whole thread Raw
In response to Re: Surprising benchmark count(1) vs. count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Surprising benchmark count(1) vs. count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
I will say I've seen count(1) in the wild a ton, as well as at my own company from developers who were used to it not making a difference.

There have been a couple queries in the hot path that I have had to changed from count(1) to count(*) as part of performance tuning, but in general it's not worth me worrying about. There are usually larger performance issues to track down in complex queries.

It would be nice if Postgres optimized this case though because it is really really common from what i've seen.

Thanks,
-Adam

pgsql-performance by date:

Previous
From: Luís Roberto Weck
Date:
Subject: Re: Slow query on a one-tuple table
Next
From: Luís Roberto Weck
Date:
Subject: Re: Slow query on a one-tuple table