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

From Tom Lane
Subject Re: Surprising benchmark count(1) vs. count(*)
Date
Msg-id 15291.1568928995@sss.pgh.pa.us
Whole thread Raw
In response to Re: Surprising benchmark count(1) vs. count(*)  (Adam Brusselback <adambrusselback@gmail.com>)
List pgsql-performance
Adam Brusselback <adambrusselback@gmail.com> writes:
> It would be nice if Postgres optimized this case though because it is
> really really common from what i've seen.

Since the introduction of the "planner support function" infrastructure,
it'd be possible to do this without it being a completely ugly kluge:
we could put the logic for it into a planner support function attached
to count(any).  Currently planner support functions are only called for
regular functions, but we could certainly envision adding the ability to
do it for aggregates (and window functions too, why not).

I'm not particularly planning to do that myself, but if someone else
wants to write a patch, have at it.

            regards, tom lane



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