| От | Tom Lane |
|---|---|
| Тема | Re: So, is COUNT(*) fast now? |
| Дата | |
| Msg-id | 29220.1319407473@sss.pgh.pa.us обсуждение |
| Ответ на | Re: So, is COUNT(*) fast now? (Jeff Janes <jeff.janes@gmail.com>) |
| Список | pgsql-hackers |
Jeff Janes <jeff.janes@gmail.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
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера