From: Rod Taylor <pg@rbt.ca>
To: Laurent Martelli <laurent@aopsys.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Speeding up select distinct
Date: Wed, 16 Mar 2005 13:10:23 -0500
Message-ID: <1110996623.1132.244.camel@home> (raw)
In-Reply-To: <87k6o74gms.fsf@stan.aopsys>
References: <87k6o74gms.fsf@stan.aopsys>
On Wed, 2005-03-16 at 18:58 +0100, Laurent Martelli wrote:
> Consider this query:
>
> SELECT distinct owner from pictures;
The performance has nothing to do with the number of rows returned, but
rather the complexity of calculations and amount of data to sift through
in order to find it.
> Any ideas, apart from more or less manually maintaining a list of
> distinct owners in another table ?
This would be the proper thing to do, along with adding a foreign key
from pictures to the new owner structure for integrity enforcement.
--
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: pg@rbt.ca, laurent@aopsys.com
Subject: Re: Speeding up select distinct
In-Reply-To: <1110996623.1132.244.camel@home>
* 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