From: Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
To: pgsql-sql@postgresql.org
Subject: Re: Question on COUNT performance
Date: Wed, 14 Jul 2010 15:44:10 +0200
Message-ID: <20100714134410.GK62243@spoetnik.xs4all.nl> (raw)
In-Reply-To: <4c3dbc01.0350e70a.18fa.388a@mx.google.com>
References: <AANLkTimyhXoid1bAk2FQZUx9TC3Qgh2Ba__-Fu4B8Bco@mail.gmail.com>
<20100714123029.GH62243@spoetnik.xs4all.nl>
<4c3dbc01.0350e70a.18fa.388a@mx.google.com>
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.v@n.leeuwen.net
http://reinoud.van.leeuwen.net kvk 27320762
__________________________________________________
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: reinoud.v@n.leeuwen.net
Subject: Re: Question on COUNT performance
In-Reply-To: <20100714134410.GK62243@spoetnik.xs4all.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox