Re: Select max(foo) and select count(*) optimization
Douglas McNaught <doug@mcnaught.org>
From: Doug McNaught <doug@mcnaught.org>
To: pgsql-performance@postgresql.org
Date: 2004-01-06T00:29:56Z
Lists: pgsql-performance
Paul Tuckfield <paul@tuckfield.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