Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5642B9FA690 for ; Mon, 9 Apr 2007 18:36:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 63294-08 for ; Mon, 9 Apr 2007 18:36:49 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.231]) by postgresql.org (Postfix) with ESMTP id 6E1229FA2BC for ; Mon, 9 Apr 2007 18:36:49 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 50so947724wri for ; Mon, 09 Apr 2007 14:36:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dfq01kr3DnPXYf7P60f7bHtQJkB3JTTtbO5hOsPD908gofBUX3jYRrLR91idLnIgeFRB9ocAJVlnJyqkrxuuNVlea5rADH8KXyJ2kRyRPGqWODYlPRECa+tLNrUouNM3rY91N9KGyIhPDws9x93U+wPDjQHS20ctUuEh+coo1tU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cXDGb14EfjMe2xfebDE+yehKQXU1CgO+Gl9YjWvbkkeDfPGr6Jq74N2oJsaLeTHy3/dI22+PbGT/iiRt8KvdtRTSTUHJ9ouCMAghXum+QV3RX6BUFZPlrL5ymrLQbwOOTXfSzZtL1ejux2qOHHpk/P1mE8b0Hk9LHi889pW/UIQ= Received: by 10.78.142.14 with SMTP id p14mr932612hud.1176154607325; Mon, 09 Apr 2007 14:36:47 -0700 (PDT) Received: by 10.78.35.18 with HTTP; Mon, 9 Apr 2007 14:36:47 -0700 (PDT) Message-ID: Date: Mon, 9 Apr 2007 17:36:47 -0400 From: "Merlin Moncure" To: "Tom Lane" Subject: Re: join to view over custom aggregate seems like it should be faster Cc: "PostgreSQL Performance" In-Reply-To: <10651.1176152866@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <10651.1176152866@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/217 X-Sequence-Number: 24094 On 4/9/07, Tom Lane wrote: > "Merlin Moncure" writes: > > I have an odd performance issue on 8.2 that I'd thought I'd document > > here. I have a workaround, but I'm if there is something that I'm not > > seeing. > > It's hard to comment on this without seeing the full details of the view > and tables. I'm wondering where the SubPlans are coming from, for instance. ah, it looks like the aggregate is being re-expanded for each field returned by the aggregate. I notice this for non-trivial record returning functions also. standard m.o. is to push into a subquery and expand afterwords. merlin