pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Diehl, Jeffrey <jdiehl@sandia.gov>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
To: Diehl, Jeffrey <jdiehl@sandia.gov>
Cc: pgsql-sql@postgresql.org
Subject: Re: Out of free buffers... HELP!
Date: Thu, 20 Sep 2001 12:49:10 -0600
Message-ID: <B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt> (raw)

Well, this was just a suggestion to make my queries run fast.  I didn't
quite understand the difference between the two, so I thought I'd ask.

Thanx for clearing that up for me.

Mike Diehl,
Network Monitoring Tool Devl.
Sandia National Laboratories.
(505) 284-3137
jdiehl@sandia.gov

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: September 20, 2001 12:56 AM
> To: Diehl, Jeffrey
> Cc: 'Haller Christoph'; pgsql-sql@postgresql.org
> Subject: Re: [SQL] Out of free buffers... HELP!
> 
> 
> "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
> 




view thread (19+ messages)  latest in thread

Message-ID: <B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt>
Permalink:  ../B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt/
Also on:    postgresql.org/message-id/B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jdiehl@sandia.gov, tgl@sss.pgh.pa.us
  Subject: Re: Out of free buffers... HELP!
  In-Reply-To: <B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt>
  References: <B51F0C636E578A4E832D3958690CD73E0130C041@es04snlnt>

* 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