Thread

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

    Adam Brusselback <adambrusselback@gmail.com> — 2019-09-19T20:38:33Z

    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