X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2F70AD1B4F0 for ; Fri, 10 Oct 2003 01:28:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 83329-06 for ; Thu, 9 Oct 2003 22:27:50 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id E3A72D1B4EE for ; Thu, 9 Oct 2003 22:27:45 -0300 (ADT) Received: (qmail 18716 invoked by uid 500); 10 Oct 2003 01:35:22 -0000 Date: Thu, 9 Oct 2003 20:35:22 -0500 From: Bruno Wolff III To: Dror Matalon Cc: Postgresql Performance Subject: Re: Speeding up Aggregates Message-ID: <20031010013522.GB18596@wolff.to> Mail-Followup-To: Dror Matalon , Postgresql Performance References: <20031003202120.GO87525@rlx11.zapatec.com> <1065217488.91586.3.camel@jester> <20031003215347.GQ87525@rlx11.zapatec.com> <1065219028.91586.8.camel@jester> <87llrvbx0f.fsf@stark.dyndns.tv> <20031008181819.GJ2979@rlx11.zapatec.com> <87ekxm9fjf.fsf@stark.dyndns.tv> <20031010004446.GN2979@rlx11.zapatec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031010004446.GN2979@rlx11.zapatec.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/316 X-Sequence-Number: 4064 On Thu, Oct 09, 2003 at 17:44:46 -0700, Dror Matalon wrote: > > How is doing order by limit 1 faster than doing max()? Seems like the > optimizer will need to sort or scan the data set either way. That part > didn't actually make a difference in my specific case. max() will never be evaluated by using an index to find the greatest value. So in many cases using order by and limit 1 is faster.