| От | Tom Lane |
|---|---|
| Тема | Re: Out of free buffers... HELP! |
| Дата | |
| Msg-id | 1701.1000968954@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Out of free buffers... HELP! ("Diehl, Jeffrey" <jdiehl@sandia.gov>) |
| Список | pgsql-sql |
"Diehl, Jeffrey" <jdiehl@sandia.gov> writes:
> Ok, can someone explain to me why this first query might run faster than the
> second?
> select src,dst,count(dst) from data;
> select src,dst,count(*) from data;
Hmm, I'd expect the second to be marginally faster. count(*) counts the
number of rows matching the WHERE condition; count(foo) counts the
number of rows matching the WHERE condition for which foo is not NULL.
So count(foo) ought to involve a couple extra cycles to test for
non-NULL-ness of the specified field. But it's hard to believe you
could measure the difference --- what results are you getting?
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера