Re: how many records

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Stuart Woodward <woodward(at)garage(dot)co(dot)jp>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how many records
Date: 2003-09-11 01:50:27
Message-ID: 20030911015027.GA8580@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Sep 11, 2003 at 10:20:23 +0900,
Stuart Woodward <woodward(at)garage(dot)co(dot)jp> wrote:
> > Bryan Irvine wrote:
> > Is there an easy way to count how many records there are?
>
> On Wed, 10 Sep 2003 18:26:30 +0100
> Simon Willison <cs1spw(at)bath(dot)ac(dot)uk> wrote:
>
> > Yes, using count(*):
> > select count(*) from tablename;
>
> Is there any performance difference in explicitly naming a column to
> count?
>
> i.e select count(id) from tablename;

Note that select count(id) and select count(*) can return different numbers.
Select count(*) is equivalent to select count(1) and I believe that
transformation (or something equivalent) is made by postgres.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Derrick Betts 2003-09-11 02:34:32 Invalid Blob length
Previous Message Stuart Woodward 2003-09-11 01:20:23 Re: how many records