Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9065C63375F for ; Sat, 9 Jan 2010 08:51:54 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 76681-10 for ; Sat, 9 Jan 2010 12:51:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mail.postgresql.org (Postfix) with ESMTP id A82E963272D for ; Sat, 9 Jan 2010 08:51:43 -0400 (AST) Received: by bwz5 with SMTP id 5so12863710bwz.3 for ; Sat, 09 Jan 2010 04:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Q7RXs7uT1GupN/PnZjB7blYUpRELZZ5rbKn6sKi5kiM=; b=HuHDOBsWodNhOOFzF60Rk/GFRNgx+aeposUswtipNMxS+oPNiw6x80iceGzXCOV9VQ 6yFkOYUqGlNPqOKaWHtfmHQTVV0mSFS1cKhND394m5tLApdYr+BI+vwZfpbEaV69hmie Q5u9UD8WiIl/qIh20TEKUphBHdw56iCfAHgm0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=bvCuQM3h+eZJ5FiaXAmYZxWuMbp19485XgPaaGv8p/AWzR6I9evK2EtWNAdOaWU4tT PyGLrFfvext2m+zHgQ0xvtazOr4yB1bLqjWYFUnk2amPaeyZBUQa1/SLGhgH0TUcIpJ2 fmavIqkJZD6K0jOZanUR0nSAoqV66ZZnMCK34= MIME-Version: 1.0 Received: by 10.204.36.202 with SMTP id u10mr2040901bkd.196.1263041501396; Sat, 09 Jan 2010 04:51:41 -0800 (PST) In-Reply-To: <4B487A8F.6000003@cam.ac.uk> References: <4B487A8F.6000003@cam.ac.uk> Date: Sat, 9 Jan 2010 12:51:41 +0000 Message-ID: <2f4958ff1001090451j69934f2awce0a4c1fc7a27364@mail.gmail.com> Subject: Re: Joint index including MAX() ? From: =?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= To: Richard Neill Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.193 tagged_above=-10 required=5 tests=AWL=0.406, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/164 X-Sequence-Number: 37044 you can also try : select val FROM table ORDER BY val DESC LIMIT 1; which usually is much quicker.