Re: Out of free buffers... HELP!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Diehl, Jeffrey" <jdiehl(at)sandia(dot)gov>
Cc: "'Haller Christoph'" <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Out of free buffers... HELP!
Date: 2001-09-20 06:55:54
Message-ID: 1701.1000968954@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Diehl, Jeffrey" <jdiehl(at)sandia(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mohammad Faisal 2001-09-20 07:58:46 Trigger Problem
Previous Message Josh Berkus 2001-09-20 00:35:37 Re: Out of free buffers... HELP!