Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8K6uUe75185 for ; Thu, 20 Sep 2001 02:56:31 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f8K6tsK01704; Thu, 20 Sep 2001 02:55:54 -0400 (EDT) To: "Diehl, Jeffrey" cc: "'Haller Christoph'" , pgsql-sql@postgresql.org Subject: Re: Out of free buffers... HELP! In-reply-to: References: Comments: In-reply-to "Diehl, Jeffrey" message dated "Wed, 19 Sep 2001 15:00:00 -0600" Date: Thu, 20 Sep 2001 02:55:54 -0400 Message-ID: <1701.1000968954@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200109/164 X-Sequence-Number: 4845 "Diehl, Jeffrey" 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