Re: Select max(foo) and select count(*) optimization

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Select max(foo) and select count(*) optimization
Date: 2004-01-06 00:29:56
Message-ID: 87oeth537f.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Paul Tuckfield <paul(at)tuckfield(dot)com> writes:

> In the case of select count(*), one optimization is to do a scan of the
> primary key, not the table itself, if the table has a primary key. In a
> certain commercial, lesser database, this is called an "index fast full
> scan". It would be important to scan the index in physical order
> (sequential physical IO) and not in key order (random physical IO)

That won't work because you still have to hit the actual tuple to
determine visibility.

-Doug

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2004-01-06 01:46:00 Re: Select max(foo) and select count(*) optimization
Previous Message Paul Tuckfield 2004-01-06 00:24:26 Re: Select max(foo) and select count(*) optimization