Re: Count(*) Question

From: "Joel Burton" <joel(at)joelburton(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Peter Darley" <pdarley(at)kinesis-cem(dot)com>
Cc: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Count(*) Question
Date: 2002-05-01 16:40:56
Message-ID: JGEPJNMCKODMDHGOBKDNGEFBCMAA.joel@joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > I was reading through the Rules section of the online docs,
> and noticed the
> > following note: (* is just an abbreviation for all the
> attribute names of a
> > relation. It is expanded by the parser into the individual
> attributes, so
> > the rule system never sees it.)
> > Does this mean that count(*) may return less than the total
> number of
> > records if all the fields in a record are NULL?
>
> Yes, I beleive so.
>
> > If this is true, is there a better way to get a count of records?
>
> I think count(1) is the common suggestion.

Interesting. In 7.3devel, it does not fail to count the completely-null rows
in count(*). Does it actually do this for any version?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Snyder 2002-05-01 17:12:35 Re: [GENERAL] Fwd: Postfix Relay Hub SMTP server: errors from pos
Previous Message Peter Darley 2002-05-01 16:02:24 Re: What popular, large commercial websites run PostgreSQL?