From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: So, is COUNT(*) fast now? |
Date: | 2011-10-23 22:04:33 |
Message-ID: | 29220.1319407473@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> count(*) and sum(1) do different things internally, and in my hands
> sum(1) is ~10% slower.
> I don't know how to dump the output of ExecBuildProjectionInfo into a
> human readable form, so I don't know the basis of the difference. But
> I wonder if using count(*) would lower the weight of the ExecProject
> function.
Probably. count() doesn't actually have any arguments, so there's
nothing for ExecProject to do. sum(1) invokes the generic case there
(ExecTargetList). I suppose we could add another special-case path for
constant tlist elements, but I suspect that would mostly be optimizing
for benchmarks rather than helping real-world cases.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-10-23 22:34:47 | Re: termination of backend waiting for sync rep generates a junk log message |
Previous Message | Jeff Janes | 2011-10-23 21:52:35 | Re: So, is COUNT(*) fast now? |