Skip site navigation (1) Skip section navigation (2)

Re: which one is faster

From: Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: which one is faster
Date: 2010-10-26 12:32:54
Message-ID: 4CC6CA76.1020509@vmsinfo.com (view raw or flat)
Thread:
Lists: pgsql-performance
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


In response to

pgsql-performance by date

Next:From: Robert HaasDate: 2010-10-26 12:41:13
Subject: Re: BBU Cache vs. spindles
Previous:From: Robert HaasDate: 2010-10-26 12:24:34
Subject: Re: Auto ANALYZE criteria

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group