From: Mladen Gogala <mladen.gogala@vmsinfo.com>
To: pgsql-performance@postgresql.org
Subject: Re: which one is faster
Date: Tue, 26 Oct 2010 08:32:54 -0400
Message-ID: <4CC6CA76.1020509@vmsinfo.com> (raw)
In-Reply-To: <AANLkTimgjmGCcxjSmf6BvQ=BBGLBrMspfcFgWhrpsVVr@mail.gmail.com>
References: <AANLkTimgjmGCcxjSmf6BvQ=BBGLBrMspfcFgWhrpsVVr@mail.gmail.com>
On 10/26/2010 6:56 AM, AI Rumman wrote:
> Which one is faster?
> select count(*) from talble
> or
> select count(id) from table
> where id is the primary key.
PostgreSQL doesn't utilize the access methods known as "FULL INDEX SCAN"
and "FAST FULL INDEX SCAN", so the optimizer will generate the
sequential scan in both cases. In other words, PostgreSQL will read the
entire table when counting, no matter what.
--
Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
www.vmsinfo.com
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-performance@postgresql.org
Cc: mladen.gogala@vmsinfo.com
Subject: Re: which one is faster
In-Reply-To: <4CC6CA76.1020509@vmsinfo.com>
* 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