Re: Question on COUNT performance

From: Reinoud van Leeuwen <reinoud(dot)v(at)n(dot)leeuwen(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question on COUNT performance
Date: 2010-07-14 13:44:10
Message-ID: 20100714134410.GK62243@spoetnik.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jul 14, 2010 at 07:30:39AM -0600, Joshua Tolley wrote:

> > Have you tried 'select count (1)..."?
>
> If this helps at all, it's unlikely to help much. I remember having seen
> discussion somewhere that there's an optimization such that count(*) and
> count(1) do the same thing anyway, but I can't find it in the code
> immediately.

oops, I was thinking too much about Sybase (where is makes a huge
difference, since the optimiser sees that everything it needs can be found
in the index so the table does not have to be read at all).

Reinoud

--
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud(dot)v(at)n(dot)leeuwen(dot)net
http://reinoud.van.leeuwen.net kvk 27320762
__________________________________________________

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2010-07-14 16:06:22 Re: subtract two dates to get the number of days
Previous Message Joshua Tolley 2010-07-14 13:30:39 Re: Question on COUNT performance