Re: query help - Mailing list pgsql-novice

From Tom Lane
Subject Re: query help
Date
Msg-id 14293.1155216684@sss.pgh.pa.us
Whole thread Raw
In response to Re: query help  (Brendon Gleeson <brendon@gleesonprop.co.za>)
List pgsql-novice
Brendon Gleeson <brendon@gleesonprop.co.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

pgsql-novice by date:

Previous
From: Brendon Gleeson
Date:
Subject: Re: query help
Next
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: ident authentication failed for user postgres.