Re: Out of free buffers... HELP! - Mailing list pgsql-sql

From Tom Lane
Subject Re: Out of free buffers... HELP!
Date
Msg-id 1701.1000968954@sss.pgh.pa.us
Whole thread Raw
In response to Re: Out of free buffers... HELP!  ("Diehl, Jeffrey" <jdiehl@sandia.gov>)
List 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 by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Out of free buffers... HELP!
Next
From: Haller Christoph
Date:
Subject: Re: Registring a C function in PostgreSQL II