Re: Speeding up select distinct

From: Rod Taylor
Subject: Re: Speeding up select distinct
Date: ,
Msg-id: 1110996623.1132.244.camel@home
(view: Whole thread, Raw)
In response to: Speeding up select distinct  (Laurent Martelli)
Responses: Re: Speeding up select distinct  (Laurent Martelli)
List: pgsql-performance

Tree view

Speeding up select distinct  (Laurent Martelli, )
 Re: Speeding up select distinct  (PFC, )
  Re: Speeding up select distinct  (Laurent Martelli, )
   Re: Speeding up select distinct  (Greg Stark, )
 Re: Speeding up select distinct  (Rod Taylor, )
  Re: Speeding up select distinct  (Laurent Martelli, )
   Re: Speeding up select distinct  (Rod Taylor, )
 Re: Speeding up select distinct  ("Merlin Moncure", )
  Re: Speeding up select distinct  (Laurent Martelli, )
 Re: Speeding up select distinct  ("Merlin Moncure", )

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



pgsql-performance by date:

From: Tom Lane
Date:
Subject: Re: cpu_tuple_cost
From: David Brown
Date:
Subject: Re: multi-column index