From: Tom Lane <tgl@sss.pgh.pa.us>
To: Diehl, Jeffrey <jdiehl@sandia.gov>
Cc: 'Haller Christoph' <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Out of free buffers... HELP!
Date: Thu, 20 Sep 2001 02:55:54 -0400
Message-ID: <1701.1000968954@sss.pgh.pa.us> (raw)
In-Reply-To: <B51F0C636E578A4E832D3958690CD73E0130C03E@es04snlnt>
References: <B51F0C636E578A4E832D3958690CD73E0130C03E@es04snlnt>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, jdiehl@sandia.gov, ch@rodos.fzk.de
Subject: Re: Out of free buffers... HELP!
In-Reply-To: <1701.1000968954@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox