Re: SELECT DISTINCT too slow - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: SELECT DISTINCT too slow
Date
Msg-id 20060601145327.GA19388@surnet.cl
Whole thread Raw
In response to Re: SELECT DISTINCT too slow  (Miroslav Šulc <miroslav.sulc@startnet.cz>)
Responses Re: SELECT DISTINCT too slow
Re: SELECT DISTINCT too slow
List pgsql-sql
Miroslav ?ulc wrote:
> Well, "key" is not primary key from another table. It is just a column
> in pair "key" => "value".
> The structure of the table is this:
> 
> Id (primary key)
> MRTPContactId (id of contact from table MRTPContact)
> Key (key from pair key => value)
> Value (value from pair key => value)
> 
> So I want the get the list of keys used in the table.

The plan you get is the most efficient possible for that query.  If you
had a table of possible keys (which should of course be FK of "Key"),
you could get a much faster version :-)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-sql by date:

Previous
From: Miroslav Šulc
Date:
Subject: Re: SELECT DISTINCT too slow
Next
From: Miroslav Šulc
Date:
Subject: Re: SELECT DISTINCT too slow