Re: group by will not use an index?

From: tsuraan <tsuraan(at)gmail(dot)com>
To: "Andrew Lazarus" <andrew(at)pillette(dot)com>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: group by will not use an index?
Date: 2007-01-10 17:14:13
Message-ID: 84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> For the reasons indicated (that is, MVCC), PG can not do a DISTINCT or the
> equivalent
> GROUP BY from index values alone.

Ok, that makes sense. Thanks for the help everybody!

If this table is large, perhaps you could denormalize and maintain a
> summary table with date (using truncation) and count, updated with
> triggers on the original table. This table will presumably have a
> small number of rows at the cost of doubling the times for updates,
> inserts, and deletes.

Well, the inserted time, at least, is never updated, and deletions are very
rare (never, so far), so I'll have a look at doing things that way. Thanks!

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-01-10 17:15:44 Re: Slow inner join, but left join is fast
Previous Message Jeremy Haile 2007-01-10 16:17:22 Slow inner join, but left join is fast