Re: Why does a simple query not use an obvious index?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Why does a simple query not use an obvious index?
Date: 2004-08-30 19:40:50
Message-ID: 20040830194050.GA1862@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Aug 30, 2004 at 21:21:26 +0200,
Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com> wrote:
> >>Also, count(*) is likely to always generate a seq scan due to the way
> >>aggregates are implemented currently in pgsql. you might want to try:
>
>
> By the way, in an ideal world, count(*) should only read the index
> on the timetamp column, not the rows. I guess this is not the case. Would
> this be an useful optimization ?

It's in the archives. The short answer is that no, postgres has to check
the heap to check tuple visibility to the current transaction.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2004-08-30 20:04:00 Re: seqscan instead of index scan
Previous Message Pierre-Frédéric Caillaud 2004-08-30 19:39:17 Re: seqscan instead of index scan