pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tsuraan <tsuraan@gmail.com>
To: Andrew Lazarus <andrew@pillette.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: group by will not use an index?
Date: Wed, 10 Jan 2007 11:14:13 -0600
Message-ID: <84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com> (raw)
In-Reply-To: <1961410679.20070109174127@pillette.com>
References: <84fb38e30701091505n59e85c74i27e6ab0e5cdfdd03@mail.gmail.com>
	<1168386124.20602.185.camel@state.g2switchworks.com>
	<1961410679.20070109174127@pillette.com>

> 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!

view thread (7+ messages)

Message-ID: <84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com>
Permalink:  ../84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com/
Also on:    postgresql.org/message-id/84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tsuraan@gmail.com, andrew@pillette.com
  Subject: Re: group by will not use an index?
  In-Reply-To: <84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com>
  References: <84fb38e30701091505n59e85c74i27e6ab0e5cdfdd03@mail.gmail.com> <1168386124.20602.185.camel@state.g2switchworks.com> <1961410679.20070109174127@pillette.com> <84fb38e30701100914y63010d26n8401d74729d12380@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox