Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 0D9BD9F9870 for ; Sat, 3 Nov 2007 22:57:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 96527-08 for ; Sat, 3 Nov 2007 22:57:14 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.187]) by postgresql.org (Postfix) with ESMTP id D2CC69F9847 for ; Sat, 3 Nov 2007 22:57:22 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id l15so997108rvb for ; Sat, 03 Nov 2007 18:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=KxAx/nSGL+QA3XCwE+LSvIlW6ixMevPHZN167/bFkQ0=; b=sHztdXLMx83LUi8fqEFXI8LkInUoiEIHBcoQMGEV12OlVhlZextX2SHdXFaX2KTjVnRkkm3l13sTa9j8PBxBLWY/0w3txSExXnYgqgNkzO57lCHyj1O8WLxnKqUsdAiy7YHut/jclfGNC0TA0AahWMwp+J2V7LpFv5KfbeFB/v4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QUplGcXp4kvWUi7oGSGzECeJwnmlAen000wzR6l6V/yBXI2mJq+xPPQWGecRu3hmTXGS3kpK6KhAsLuT8Nqd+yLl2vKHIVn9dXdaGZ8xQhwJUtzp/gttlkszYbhBJcTEVLfpHOqxLArD/7RHPGQRzpufbIGcGTSUPQwx9L7BpC0= Received: by 10.142.214.5 with SMTP id m5mr798551wfg.1194141441147; Sat, 03 Nov 2007 18:57:21 -0700 (PDT) Received: by 10.143.35.10 with HTTP; Sat, 3 Nov 2007 18:57:21 -0700 (PDT) Message-ID: Date: Sat, 3 Nov 2007 20:57:21 -0500 From: "Jeff Larsen" To: pgsql-performance@postgresql.org Subject: Re: Union within View vs.Union of Views In-Reply-To: <3248.1194140315@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <472CFE4B.5060606@enterprisedb.com> <3248.1194140315@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/44 X-Sequence-Number: 27459 [[ Oops, still not used to gmail. Accidentally posted this straight to Tom and not the list]] > There are a bunch of special cases where it can't do that, though. > Look into src/backend/optimizer/path/allpaths.c, particularly > subquery_is_pushdown_safe: My case probably fits the 'special case' description. Not all the columns in each subquery matched up, so there were NULL::text placeholders in some spots in the SELECT. In the case where performance got bad, one of those columns was included in the application's WHERE clause. That's a good enough explanation for me. I'll spare you the gory details of my tables, unless a developer wants to have a look at it off-list. Jeff