From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adam Brusselback <adambrusselback@gmail.com>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Surprising benchmark count(1) vs. count(*)
Date: Thu, 19 Sep 2019 17:36:35 -0400
Message-ID: <15291.1568928995@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMjNa7ftSKUFp4SO07ctTqBsQ5s7TjA89UFe_j1LON82b-oN0A@mail.gmail.com>
References: <df354b76-a645-73fc-9645-4508e5291d71@gmx.net>
<ab88db80f032933ff603d9d59745e8a09196bc1e.camel@cybertec.at>
<35f81ca4-f68e-8b71-d34c-7364751b4e36@gmx.net>
<22758.1568902312@sss.pgh.pa.us>
<CAMjNa7ftSKUFp4SO07ctTqBsQ5s7TjA89UFe_j1LON82b-oN0A@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, adambrusselback@gmail.com, spam_eater@gmx.net, pgsql-performance@lists.postgresql.org
Subject: Re: Surprising benchmark count(1) vs. count(*)
In-Reply-To: <15291.1568928995@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox