Re: query help

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brendon Gleeson <brendon(at)gleesonprop(dot)co(dot)za>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: query help
Date: 2006-08-10 13:31:24
Message-ID: 14293.1155216684@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Brendon Gleeson <brendon(at)gleesonprop(dot)co(dot)za> writes:
> ** apparently count(1) is faster than count(*) and count(id), my Rails log
> confirms this, however I have a limited amount of records at the moment so
> benchmarks are properly inaccurate..

count(1) and count(*) are exactly the same thing (in existing PG
releases anyway), so whatever you're looking at is measurement noise.
count(id) would properly be slower because of the need to examine the
field to see if it's null.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-08-10 15:35:42 Re: libpq Describe Extension [WAS: Bytea and perl]
Previous Message Walid Haider 2006-08-10 13:10:00 Unable to connect to PostgreSQL 8 from PGAdmin III