From: Andrew Lazarus <andrew@pillette.com>
To: tsuraan <tsuraan@gmail.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: group by will not use an index?
Date: Tue, 9 Jan 2007 17:41:27 -0800
Message-ID: <1961410679.20070109174127@pillette.com> (raw)
In-Reply-To: <1168386124.20602.185.camel@state.g2switchworks.com>
References: <84fb38e30701091505n59e85c74i27e6ab0e5cdfdd03@mail.gmail.com>
<1168386124.20602.185.camel@state.g2switchworks.com>
For the reasons indicated (that is, MVCC), PG can not do a DISTINCT or the equivalent
GROUP BY from index values alone.
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.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: andrew@pillette.com, tsuraan@gmail.com
Subject: Re: group by will not use an index?
In-Reply-To: <1961410679.20070109174127@pillette.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