X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id F21999F9B01 for ; Thu, 25 May 2006 17:45:53 -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 29322-09 for ; Thu, 25 May 2006 17:45:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 7FD489F94EA for ; Thu, 25 May 2006 17:45:43 -0300 (ADT) Received: (qmail 27753 invoked by uid 500); 25 May 2006 20:47:46 -0000 Date: Thu, 25 May 2006 15:47:46 -0500 From: Bruno Wolff III To: Merlin Moncure Cc: Postgresql Performance Subject: Re: is it possible to make this faster? Message-ID: <20060525204746.GA26341@wolff.to> Mail-Followup-To: Bruno Wolff III , Merlin Moncure , Postgresql Performance References: <20060525202314.GA20747@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/475 X-Sequence-Number: 19262 On Thu, May 25, 2006 at 16:31:40 -0400, Merlin Moncure wrote: > On 5/25/06, Bruno Wolff III wrote: > >On Thu, May 25, 2006 at 16:07:19 -0400, > > Merlin Moncure wrote: > >> been doing a lot of pgsql/mysql performance testing lately, and there > >> is one query that mysql does much better than pgsql...and I see it a > >> lot in normal development: > >> > >> select a,b,max(c) from t group by a,b; > >> > > >SELECT DISTINCT ON (a, b) a, b, c FROM t ORDER BY a DESC, b DESC, c DESC; > > that is actually slower than group by in my case...am i missing > something? (both essentially resolved to seq_scan) If there aren't many c's for each (a,b), then a sort might be the best way to do this. I don't remember if skip scanning ever got done, but if it did, it would have been 8.1 or later.