X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1BEF99FA040 for ; Thu, 1 Jun 2006 12:03:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 16685-02 for ; Thu, 1 Jun 2006 12:03:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from titan.startnet.cz (unknown [82.113.63.73]) by postgresql.org (Postfix) with ESMTP id E533E9FA5DC for ; Thu, 1 Jun 2006 12:03:32 -0300 (ADT) Received: (qmail 32555 invoked from network); 1 Jun 2006 17:03:28 +0200 Received: from unknown (HELO ?192.168.1.2?) (miroslav.sulc@startnet.cz@10.15.192.25) by titan.local.startnet.cz with ESMTPA; 1 Jun 2006 17:03:28 +0200 Message-ID: <447F01BA.5040108@startnet.cz> Date: Thu, 01 Jun 2006 17:03:22 +0200 From: =?windows-1252?Q?Miroslav_=8Aulc?= Organization: StartNet s.r.o. User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: SELECT DISTINCT too slow References: <447EEAF1.7040305@startnet.cz> <20060601135310.GB18513@surnet.cl> <447EFE92.2070509@startnet.cz> <20060601145327.GA19388@surnet.cl> In-Reply-To: <20060601145327.GA19388@surnet.cl> Content-Type: multipart/mixed; boundary="------------050800000504000409020702" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/7 X-Sequence-Number: 25243 This is a multi-part message in MIME format. --------------050800000504000409020702 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit It might be a good solution :-) Thank you for your help. Miroslav Šulc Alvaro Herrera napsal(a): > 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 :-) > > --------------050800000504000409020702 Content-Type: text/x-vcard; charset=utf-8; name="miroslav.sulc.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="miroslav.sulc.vcf" begin:vcard fn;quoted-printable:Miroslav =C5=A0ulc n;quoted-printable:=C5=A0ulc;Miroslav org:StartNet s.r.o. adr;quoted-printable;quoted-printable:;;Schodov=C3=A1 309/10;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika email;internet:miroslav.sulc@startnet.cz tel;cell:+420 603 711 413 x-mozilla-html:TRUE url:http://www.startnet.cz version:2.1 end:vcard --------------050800000504000409020702--