Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B8BE1641A03 for ; Thu, 10 Jun 2010 16:41:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 37268-05 for ; Thu, 10 Jun 2010 19:41:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.erwied.eu (mail.erwied.eu [85.214.80.157]) by mail.postgresql.org (Postfix) with ESMTP id 4562064199B for ; Thu, 10 Jun 2010 16:41:41 -0300 (ADT) Received: from dslb-094-220-107-153.pools.arcor-ip.net ([94.220.107.153] helo=erwied.dns2go.com ident=mail) by mail.erwied.eu with esmtpsa (Exim 4.71#1) id 1OMnKT-0003hJ-Sv ; Thu, 10 Jun 2010 21:22:18 +0200 Received: from [172.17.10.71] (helo=localhost) by erwied.dns2go.com with esmtpsa (Exim 4.71#1) id 1OMnKS-0004Mx-AZ ; Thu, 10 Jun 2010 21:22:16 +0200 Date: Thu, 10 Jun 2010 21:22:11 +0200 From: Jochen Erwied Organization: Creative Chaos Computing X-Priority: 3 (Normal) Message-ID: <98414706.20100610212211@erwied.eu> To: Anne Rosset CC: pgsql-performance@postgresql.org Subject: Re: Need to increase performance of a query In-Reply-To: <4C113098.5040105@collab.net> References: <4C1125F0.8090101@collab.net> <4C112B19.6080908@krogh.cc> <4C113098.5040105@collab.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Antivirus: avast! (VPS 100610-1, 10.06.2010), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/179 X-Sequence-Number: 39035 Thursday, June 10, 2010, 8:36:08 PM you wrote: > psrdb=3D# (SELECT > psrdb(# MAX(item_rank.rank) AS maxRank > psrdb(# FROM > psrdb(# item_rank item_rank > psrdb(# WHERE > psrdb(# item_rank.project_id=3D'proj2783' > psrdb(# AND item_rank.pf_id IS NULL > psrdb(# > psrdb(# ) > psrdb-# ORDER BY > psrdb-# maxRank DESC; Don't think it does really matter, but why do you sort a resultset=20 consisting of only one row? --=20 Jochen Erwied | home: jochen@erwied.eu +49-208-38800-18, FAX: -19 Sauerbruchstr. 17 | work: joe@mbs-software.de +49-2151-7294-24, FAX: -50 D-45470 Muelheim | mobile: jochen.erwied@vodafone.de +49-173-5404164