Re: Why count(*) doest use index?

From: Glenn Maynard <glenn(at)zewt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why count(*) doest use index?
Date: 2011-03-08 19:29:58
Message-ID: AANLkTin_kCyR8VFGnMu2tC7OxjK+00QJ3_4FWS-cLK73@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 8, 2011 at 10:42 AM, Igor Neyman <ineyman(at)perceptron(dot)com> wrote:

> Indexes don't "maintain counts", indexes maintain pointers to the table
> records.
>

The whole point is that they don't, even if you can afford the costs.

What you need is "materialized view" storing aggregates.
> And it looks like you already have it with your triggers.
>

With cumbersome, awkward triggers, yes.

--
Glenn Maynard

In response to

Browse pgsql-general by date

  From Date Subject
Next Message akp geek 2011-03-08 21:23:42 @@ to_tsquery help
Previous Message Andy Colson 2011-03-08 19:06:43 Re: Using bytea field...