X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C62D552834 for ; Mon, 6 Jun 2005 08:45:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54576-02 for ; Mon, 6 Jun 2005 11:45:39 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 8D0285283B for ; Mon, 6 Jun 2005 08:45:37 -0300 (ADT) Received: (qmail 30505 invoked from network); 6 Jun 2005 13:45:45 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 13:45:45 +0200 To: "K C Lau" , pgsql-performance@postgresql.org Subject: Re: SELECT DISTINCT Performance Issue References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> Message-ID: From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Mon, 06 Jun 2005 13:45:39 +0200 In-Reply-To: <6.2.1.2.0.20050602190756.05ab2c70@localhost> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/105 X-Sequence-Number: 12742 > Previously, we have also tried to use LIMIT 1 instead of DISTINCT, but > the performance was no better: > select PlayerID,AtDate from Player where PlayerID='22220' order by > PlayerID desc, AtDate desc LIMIT 1 The DISTINCT query will pull out all the rows and keep only one, so the one with LIMIT should be faster. Can you post explain analyze of the LIMIT query ?